結果
| 問題 |
No.1439 Let's Compare!!!!
|
| コンテスト | |
| ユーザー |
tenten
|
| 提出日時 | 2021-03-30 11:37:59 |
| 言語 | Java (openjdk 23) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,557 bytes |
| コンパイル時間 | 2,189 ms |
| コンパイル使用メモリ | 77,684 KB |
| 実行使用メモリ | 70,544 KB |
| 最終ジャッジ日時 | 2024-11-30 08:50:25 |
| 合計ジャッジ時間 | 18,433 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 15 WA * 1 TLE * 1 |
ソースコード
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();
int compare = 0;
int col = 0;
for (int i = 0; i < n; i++) {
if (s[i] == t[i]) {
continue;
}
compare = s[i] - t[i];
col = i;
break;
}
if (compare == 0) {
col = n;
}
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 (col >= c) {
for (int j = c; j < n; j++) {
if (s[j] == t[j]) {
continue;
}
compare = s[j] - t[j];
col = j;
break;
}
}
if (compare == 0) {
col = n;
}
if (compare == 0) {
sb.append("=");
} else if (compare < 0) {
sb.append("<");
} else {
sb.append(">");
}
sb.append("\n");
}
System.out.print(sb);
}
}
tenten