結果
問題 |
No.1439 Let's Compare!!!!
|
ユーザー |
![]() |
提出日時 | 2021-03-30 11:46:50 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 1,652 ms / 2,000 ms |
コード長 | 1,211 bytes |
コンパイル時間 | 2,568 ms |
コンパイル使用メモリ | 79,824 KB |
実行使用メモリ | 71,148 KB |
最終ジャッジ日時 | 2024-11-30 09:02:00 |
合計ジャッジ時間 | 18,058 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 17 |
ソースコード
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); char[] s = sc.next().toCharArray(); char[] t = sc.next().toCharArray(); TreeSet<Integer> diff = new TreeSet<>(); for (int i = 0; i < n; i++) { if (s[i] != t[i]) { diff.add(i); } } int q = sc.nextInt(); StringBuilder sb = new StringBuilder(); for (int i = 0; i < q; i++) { char type = sc.next().charAt(0); int c = sc.nextInt() - 1; char x = sc.next().charAt(0); if (type == 'T') { t[c] = x; } else { s[c] = x; } if (t[c] == s[c]) { diff.remove(c); } else { diff.add(c); } if (diff.size() == 0) { sb.append("="); } else if (s[diff.first()] < t[diff.first()]) { sb.append("<"); } else { sb.append(">"); } sb.append("\n"); } System.out.print(sb); } }