結果
| 問題 | No.1439 Let's Compare!!!! | 
| コンテスト | |
| ユーザー |  c-yan | 
| 提出日時 | 2021-03-28 11:38:23 | 
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) | 
| 結果 | 
                                RE
                                 
                             | 
| 実行時間 | - | 
| コード長 | 849 bytes | 
| コンパイル時間 | 91 ms | 
| コンパイル使用メモリ | 12,800 KB | 
| 実行使用メモリ | 32,624 KB | 
| 最終ジャッジ日時 | 2024-11-29 08:57:33 | 
| 合計ジャッジ時間 | 2,031 ms | 
| ジャッジサーバーID (参考情報) | judge3 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 1 RE * 1 | 
| other | AC * 1 WA * 1 RE * 15 | 
ソースコード
from sys import stdin
from heapq import heapify, heappop, heappush
readline = stdin.readline
N = int(readline())
S = list(readline()[:-1])
T = list(readline()[:-1])
Q = int(readline())
s = set()
q = []
for i in range(N):
    if S[i] == T[i]:
        continue
    q.append(i)
    s.add(i)
heapify(q)
result = []
for _ in range(Q):
    c, x, y = readline().split()
    x = int(x) - 1
    is_same = S[x] == T[x]
    if  c == 'S':
        S[x] = y
    elif c == 'T':
        T[x] = y
    if S[x] == T[x] != is_same:
        if is_same:
            heappop(q, x)
            s.add(x)
        else:
            s.remove(x)
    while q[0] not in s:
        heappop(q)
    if len(q) == 0:
        result.append('=')
    elif S[q[0]] > T[q[0]]:
        result.append('>')
    elif S[q[0]] < T[q[0]]:
        result.append('<')
print(*result, sep='\n')
            
            
            
        