結果

問題 No.1439 Let's Compare!!!!
ユーザー uwiuwi
提出日時 2020-11-23 20:51:13
言語 Java19
(openjdk 21)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 1,032 bytes
コンパイル時間 7,116 ms
コンパイル使用メモリ 75,752 KB
実行使用メモリ 93,216 KB
最終ジャッジ日時 2023-08-01 20:38:05
合計ジャッジ時間 13,809 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 121 ms
62,244 KB
testcase_01 AC 130 ms
55,780 KB
testcase_02 AC 120 ms
55,548 KB
testcase_03 AC 135 ms
55,824 KB
testcase_04 AC 140 ms
55,720 KB
testcase_05 AC 134 ms
55,552 KB
testcase_06 AC 121 ms
55,836 KB
testcase_07 AC 324 ms
61,700 KB
testcase_08 AC 374 ms
58,996 KB
testcase_09 AC 319 ms
61,456 KB
testcase_10 TLE -
testcase_11 TLE -
testcase_12 TLE -
testcase_13 TLE -
testcase_14 TLE -
testcase_15 TLE -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;
import java.util.TreeSet;

public class P5533 {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		char[] s = in.next().toCharArray();
		char[] t = in.next().toCharArray();

		TreeSet<Integer> sg = new TreeSet<>();
		TreeSet<Integer> tg = new TreeSet<>();
		for(int i = 0;i < n;i++){
			if(s[i] > t[i]){
				sg.add(i);
			}else if(s[i] < t[i]){
				tg.add(i);
			}
		}
		for(int Q = in.nextInt();Q > 0;Q--){
			char c = in.next().charAt(0);
			int k = in.nextInt()-1;
			int v = in.nextInt();
			if(c == 'S'){
				s[k] = (char)('0'+v);
			}else{
				t[k] = (char)('0'+v);
			}
			sg.remove(k);
			tg.remove(k);
			if(s[k] > t[k]){
				sg.add(k);
			}else if(s[k] < t[k]){
				tg.add(k);
			}

			int mins = sg.isEmpty() ? n + 1 : sg.first();
			int mint = tg.isEmpty() ? n + 1 : tg.first();
			if(mins == mint){
				System.out.println("=");
			}else if(mins < mint) {
				System.out.println(">");
			}else{
				System.out.println("<");
			}
		}
	}
}
0