結果

問題 No.1439 Let's Compare!!!!
ユーザー uwiuwi
提出日時 2020-11-23 20:51:13
言語 Java21
(openjdk 21)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 1,032 bytes
コンパイル時間 3,443 ms
コンパイル使用メモリ 79,400 KB
実行使用メモリ 88,512 KB
最終ジャッジ日時 2024-04-19 19:52:54
合計ジャッジ時間 29,005 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 119 ms
54,136 KB
testcase_01 AC 125 ms
54,268 KB
testcase_02 AC 118 ms
53,856 KB
testcase_03 AC 129 ms
54,264 KB
testcase_04 AC 141 ms
54,188 KB
testcase_05 AC 136 ms
54,388 KB
testcase_06 AC 113 ms
53,476 KB
testcase_07 AC 330 ms
59,208 KB
testcase_08 AC 374 ms
59,444 KB
testcase_09 AC 271 ms
58,736 KB
testcase_10 TLE -
testcase_11 TLE -
testcase_12 TLE -
testcase_13 TLE -
testcase_14 TLE -
testcase_15 TLE -
testcase_16 AC 1,942 ms
69,464 KB
testcase_17 TLE -
testcase_18 AC 1,875 ms
69,952 KB
権限があれば一括ダウンロードができます

ソースコード

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