結果

問題 No.1439 Let's Compare!!!!
ユーザー ks2mks2m
提出日時 2021-03-26 21:41:14
言語 Java21
(openjdk 21)
結果
AC  
実行時間 1,037 ms / 2,000 ms
コード長 1,315 bytes
コンパイル時間 2,931 ms
コンパイル使用メモリ 75,044 KB
実行使用メモリ 80,028 KB
最終ジャッジ日時 2023-08-19 15:13:25
合計ジャッジ時間 13,009 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
49,716 KB
testcase_01 AC 40 ms
51,600 KB
testcase_02 AC 38 ms
49,520 KB
testcase_03 AC 38 ms
49,520 KB
testcase_04 AC 41 ms
49,680 KB
testcase_05 AC 40 ms
49,568 KB
testcase_06 AC 38 ms
47,560 KB
testcase_07 AC 140 ms
54,008 KB
testcase_08 AC 155 ms
58,924 KB
testcase_09 AC 125 ms
53,632 KB
testcase_10 AC 954 ms
79,656 KB
testcase_11 AC 1,015 ms
71,308 KB
testcase_12 AC 1,037 ms
78,240 KB
testcase_13 AC 1,010 ms
79,716 KB
testcase_14 AC 1,020 ms
80,028 KB
testcase_15 AC 965 ms
65,460 KB
testcase_16 AC 748 ms
62,644 KB
testcase_17 AC 706 ms
62,728 KB
testcase_18 AC 460 ms
58,336 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.TreeSet;

public class Main {
	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(br.readLine());
		char[] s = br.readLine().toCharArray();
		char[] t = br.readLine().toCharArray();
		TreeSet<Integer> sets = new TreeSet<>();
		TreeSet<Integer> sett = new TreeSet<>();
		for (int i = 0; i < n; i++) {
			if (s[i] > t[i]) {
				sets.add(i);
			}
			if (s[i] < t[i]) {
				sett.add(i);
			}
		}
		sets.add(n);
		sett.add(n);

		int q = Integer.parseInt(br.readLine());
		PrintWriter pw = new PrintWriter(System.out);
		for (int i = 0; i < q; i++) {
			String[] sa = br.readLine().split(" ");
			int x = Integer.parseInt(sa[1]) - 1;
			if (sa[0].equals("S")) {
				s[x] = sa[2].charAt(0);
			} else {
				t[x] = sa[2].charAt(0);
			}
			if (s[x] > t[x]) {
				sets.add(x);
			} else {
				sets.remove(x);
			}
			if (s[x] < t[x]) {
				sett.add(x);
			} else {
				sett.remove(x);
			}
			int s1 = sets.first();
			int t1 = sett.first();
			if (s1 == t1) {
				pw.println("=");
			} else if (s1 < t1) {
				pw.println(">");
			} else {
				pw.println("<");
			}
		}
		pw.flush();
		br.close();
	}
}
0