結果

問題 No.1439 Let's Compare!!!!
ユーザー FromBooska
提出日時 2023-03-17 18:44:14
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 971 bytes
コンパイル時間 291 ms
コンパイル使用メモリ 81,988 KB
実行使用メモリ 106,112 KB
最終ジャッジ日時 2024-09-18 10:06:40
合計ジャッジ時間 10,547 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 15 TLE * 1 -- * 1
権限があれば一括ダウンロードができます

ソースコード

diff #

# 数字が大きすぎるか
# どの桁まで同じかを管理するのでどうだろう

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

N = int(input())
S = input()
T = input()
S_list = list(map(int, S))
T_list = list(map(int, T))
same, ans = check(S_list, T_list)

Q = int(input())
for i in range(Q):
    query = list(map(str, input().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)
        print(ans)
    elif d > same+1:
        if query[0] == 'S':
            S_list[d] = new
        elif query[0] == 'T':
            T_list[d] = new
        print(ans)





0