結果
問題 | No.1439 Let's Compare!!!! |
ユーザー | uwi |
提出日時 | 2020-11-23 21:00:16 |
言語 | Java21 (openjdk 21) |
結果 |
TLE
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 1,902 bytes |
コンパイル時間 | 3,603 ms |
コンパイル使用メモリ | 79,868 KB |
実行使用メモリ | 93,196 KB |
最終ジャッジ日時 | 2024-05-06 22:08:38 |
合計ジャッジ時間 | 22,385 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 121 ms
53,848 KB |
testcase_01 | AC | 122 ms
54,044 KB |
testcase_02 | AC | 115 ms
54,172 KB |
testcase_03 | AC | 124 ms
54,256 KB |
testcase_04 | AC | 144 ms
54,352 KB |
testcase_05 | AC | 124 ms
54,044 KB |
testcase_06 | AC | 110 ms
53,220 KB |
testcase_07 | AC | 264 ms
58,192 KB |
testcase_08 | AC | 279 ms
59,188 KB |
testcase_09 | AC | 223 ms
57,740 KB |
testcase_10 | TLE | - |
testcase_11 | AC | 1,721 ms
78,456 KB |
testcase_12 | AC | 1,917 ms
83,460 KB |
testcase_13 | TLE | - |
testcase_14 | TLE | - |
testcase_15 | AC | 1,636 ms
79,160 KB |
testcase_16 | AC | 1,430 ms
71,848 KB |
testcase_17 | AC | 1,347 ms
71,932 KB |
testcase_18 | AC | 1,344 ms
70,888 KB |
ソースコード
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(); if(!(1 <= n && n <= 200000))throw new IllegalArgumentException("n"); char[] s = in.next().toCharArray(); char[] t = in.next().toCharArray(); if(s.length != n)throw new IllegalArgumentException("len of s"); if(t.length != n)throw new IllegalArgumentException("len of t"); for(int i = 0;i < n;i++){ if(!('0' <= s[i] && s[i] <= '9'))throw new IllegalArgumentException("s"); if(!('0' <= t[i] && t[i] <= '9'))throw new IllegalArgumentException("t"); } 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); } } int Q = ni(); if(!(1 <= Q && Q <= 200000))throw new IllegalArgumentException("Q"); for(;Q > 0;Q--){ String cs = in.next(); if(cs.length() != 1)throw new IllegalArgumentException("|c| != 1"); char c = cs.charAt(0); if(!(c == 'S' || c == 'T'))throw new IllegalArgumentException("c"); int k = ni()-1; if(!(0 <= k && k < n))throw new IllegalArgumentException("k"); int v = ni(); if(!(0 <= v && v <= 9))throw new IllegalArgumentException("v"); 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()); } }