結果

問題 No.1439 Let's Compare!!!!
ユーザー uwiuwi
提出日時 2020-11-23 20:54:18
言語 Java21
(openjdk 21)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 1,141 bytes
コンパイル時間 3,600 ms
コンパイル使用メモリ 76,544 KB
実行使用メモリ 87,112 KB
最終ジャッジ日時 2023-08-18 06:51:42
合計ジャッジ時間 22,616 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 111 ms
40,304 KB
testcase_01 AC 120 ms
39,876 KB
testcase_02 AC 114 ms
39,368 KB
testcase_03 AC 119 ms
39,992 KB
testcase_04 AC 129 ms
39,400 KB
testcase_05 AC 119 ms
39,680 KB
testcase_06 AC 113 ms
39,736 KB
testcase_07 AC 256 ms
45,748 KB
testcase_08 AC 291 ms
46,700 KB
testcase_09 AC 214 ms
43,108 KB
testcase_10 AC 1,933 ms
73,688 KB
testcase_11 AC 1,783 ms
74,808 KB
testcase_12 TLE -
testcase_13 AC 1,875 ms
77,928 KB
testcase_14 AC 1,854 ms
79,132 KB
testcase_15 AC 1,836 ms
78,984 KB
testcase_16 AC 1,400 ms
60,492 KB
testcase_17 AC 1,224 ms
65,888 KB
testcase_18 AC 1,200 ms
58,920 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.PrintWriter;
import java.util.Scanner;
import java.util.TreeSet;

public class P5533 {
	static Scanner in = new Scanner(System.in);
	static PrintWriter out = new PrintWriter(System.out);

	public static void main(String[] args) {
		int n = ni();
		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 = ni();Q > 0;Q--){
			char c = in.next().charAt(0);
			int k = ni()-1;
			int v = ni();
			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){
				out.println("=");
			}else if(mins < mint) {
				out.println(">");
			}else{
				out.println("<");
			}
		}
		out.flush();
	}

	static int ni(){ return Integer.parseInt(in.next()); }
}
0