結果

問題 No.1439 Let's Compare!!!!
ユーザー lie_of_lillielie_of_lillie
提出日時 2021-05-06 13:41:22
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 1,187 ms / 2,000 ms
コード長 848 bytes
コンパイル時間 82 ms
コンパイル使用メモリ 10,988 KB
実行使用メモリ 24,352 KB
最終ジャッジ日時 2023-10-12 06:18:24
合計ジャッジ時間 11,937 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 20 ms
8,736 KB
testcase_01 AC 18 ms
8,592 KB
testcase_02 AC 19 ms
8,572 KB
testcase_03 AC 19 ms
8,604 KB
testcase_04 AC 19 ms
8,700 KB
testcase_05 AC 19 ms
8,620 KB
testcase_06 AC 19 ms
8,752 KB
testcase_07 AC 39 ms
9,188 KB
testcase_08 AC 52 ms
9,180 KB
testcase_09 AC 32 ms
8,900 KB
testcase_10 AC 1,184 ms
24,208 KB
testcase_11 AC 1,064 ms
20,716 KB
testcase_12 AC 1,035 ms
20,476 KB
testcase_13 AC 1,187 ms
24,352 KB
testcase_14 AC 1,164 ms
24,352 KB
testcase_15 AC 1,085 ms
20,684 KB
testcase_16 AC 1,068 ms
20,436 KB
testcase_17 AC 1,158 ms
14,880 KB
testcase_18 AC 877 ms
13,932 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import heapq
import collections
N = int(input())
S = list(map(int, list(input())))
T = list(map(int, list(input())))
Q = int(input())
que = collections.deque()
pq = []
heapq.heapify(pq)
for i, (s, t) in enumerate(zip(S, T)):
    if s != t:
        heapq.heappush(pq, i)

for q in range(Q):
    flag, s, v = input().split()
    s = int(s)-1
    v = int(v)
    if flag == "S":
        S[s] = v
    else:
        T[s] = v
    if S[s] != T[s]:
        heapq.heappush(pq, s)

    tmp = "="
    while pq:
        cur = heapq.heappop(pq)
        if S[cur] > T[cur]:
            tmp = ">"
            heapq.heappush(pq, cur)
            break
        elif S[cur] == T[cur]:
            continue
        elif S[cur] < T[cur]:
            tmp = "<"
            heapq.heappush(pq, cur)
            break
    que.append(tmp)
while que:
    print(que.popleft())
0