結果
| 問題 |
No.1439 Let's Compare!!!!
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-02-15 19:07:17 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 780 ms / 2,000 ms |
| コード長 | 911 bytes |
| コンパイル時間 | 173 ms |
| コンパイル使用メモリ | 81,920 KB |
| 実行使用メモリ | 140,120 KB |
| 最終ジャッジ日時 | 2024-06-29 07:08:00 |
| 合計ジャッジ時間 | 8,588 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 17 |
ソースコード
from heapq import heappop, heappush
n = int(input())
S = list(map(int, list(input())))
T = list(map(int, list(input())))
op_idx = n
Heap = []
different_num_set = set()
for i in range(n):
if S[i] != T[i]:
heappush(Heap, i)
different_num_set.add(i)
q = int(input())
for _ in range(q):
c, x, y = input().split()
x = int(x)
y = int(y)
x -= 1
pre_same = S[x] == T[x]
if c == 'S':
S[x] = y
elif c == 'T':
T[x] = y
curr_same = S[x] == T[x]
if curr_same != pre_same:
if pre_same:
heappush(Heap, x)
different_num_set.add(x)
else:
different_num_set.remove(x)
while Heap and Heap[0] not in different_num_set:
heappop(Heap)
if len(Heap) == 0:
print('=')
continue
d = Heap[0]
if S[d] > T[d]:
print('>')
elif S[d] < T[d]:
print('<')