結果

問題 No.1439 Let's Compare!!!!
ユーザー tentententen
提出日時 2021-03-30 11:37:59
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 1,557 bytes
コンパイル時間 2,228 ms
コンパイル使用メモリ 77,772 KB
実行使用メモリ 70,652 KB
最終ジャッジ日時 2024-05-07 15:11:14
合計ジャッジ時間 17,491 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 123 ms
61,172 KB
testcase_01 AC 124 ms
54,012 KB
testcase_02 AC 125 ms
54,296 KB
testcase_03 AC 130 ms
54,028 KB
testcase_04 AC 135 ms
54,040 KB
testcase_05 AC 127 ms
54,156 KB
testcase_06 AC 127 ms
54,216 KB
testcase_07 AC 220 ms
58,048 KB
testcase_08 AC 245 ms
57,988 KB
testcase_09 AC 200 ms
57,528 KB
testcase_10 AC 1,058 ms
66,184 KB
testcase_11 AC 1,190 ms
68,308 KB
testcase_12 AC 1,125 ms
69,264 KB
testcase_13 AC 1,054 ms
66,508 KB
testcase_14 AC 1,090 ms
68,852 KB
testcase_15 AC 1,223 ms
68,252 KB
testcase_16 AC 1,170 ms
68,032 KB
testcase_17 WA -
testcase_18 TLE -
権限があれば一括ダウンロードができます

ソースコード

diff #

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);
    }
}
0