結果

問題 No.1439 Let's Compare!!!!
ユーザー FromBooskaFromBooska
提出日時 2023-03-17 19:09:26
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 1,368 bytes
コンパイル時間 166 ms
コンパイル使用メモリ 81,784 KB
実行使用メモリ 112,920 KB
最終ジャッジ日時 2023-10-18 13:49:43
合計ジャッジ時間 7,328 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
60,564 KB
testcase_01 AC 38 ms
51,776 KB
testcase_02 AC 39 ms
51,688 KB
testcase_03 AC 38 ms
51,884 KB
testcase_04 AC 41 ms
52,076 KB
testcase_05 AC 38 ms
51,936 KB
testcase_06 AC 38 ms
51,748 KB
testcase_07 AC 88 ms
76,992 KB
testcase_08 AC 110 ms
76,796 KB
testcase_09 AC 74 ms
73,152 KB
testcase_10 AC 364 ms
112,052 KB
testcase_11 AC 249 ms
112,248 KB
testcase_12 AC 249 ms
111,264 KB
testcase_13 AC 343 ms
112,920 KB
testcase_14 AC 340 ms
112,736 KB
testcase_15 AC 225 ms
112,140 KB
testcase_16 AC 235 ms
110,116 KB
testcase_17 AC 263 ms
110,576 KB
testcase_18 TLE -
権限があれば一括ダウンロードができます

ソースコード

diff #

# def main():にしよう
# まずNはintで受けるのか、文字列で受けるのか
# 長さ10**5はintには巨大すぎる
# 数字が大きすぎるか
# どの桁まで同じかを管理するのでどうだろう

from sys import stdin
readline = stdin.readline

def check(LIST1, LIST2, start, N):
    idx = start-1
    for i in range(start, N):
        if int(LIST1[i]) == int(LIST2[i]):
            idx = i
        elif int(LIST1[i]) > int(LIST2[i]):
            return idx, '>'
        elif int(LIST1[i]) < int(LIST2[i]):
            return idx, '<'
    return N-1, '='

def main():
    N = int(readline())
    S_list = list(readline()[:-1]) #最後は改行
    T_list = list(readline()[:-1]) #最後は改行
    same, ans = check(S_list, T_list, 0, N)
    Q = int(readline())
    for i in range(Q):
        query = list(map(str, readline().split()))
        d = int(query[1])-1
        new = int(query[2])
        if d <= same+1:
            if query[0] == 'S':
                S_list[d] = new
            elif query[0] == 'T':
                T_list[d] = new
            same, ans = check(S_list, T_list, d, N)
            print(ans)
        elif d > same+1:
            if query[0] == 'S':
                S_list[d] = new
            elif query[0] == 'T':
                T_list[d] = new
            print(ans)

if __name__ == '__main__':
    main()
0