結果
問題 | No.1439 Let's Compare!!!! |
ユーザー |
![]() |
提出日時 | 2021-03-26 22:10:26 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 821 ms / 2,000 ms |
コード長 | 866 bytes |
コンパイル時間 | 493 ms |
コンパイル使用メモリ | 12,800 KB |
実行使用メモリ | 28,024 KB |
最終ジャッジ日時 | 2024-11-29 08:48:08 |
合計ジャッジ時間 | 8,504 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 17 |
ソースコード
import sys input = sys.stdin.readline import heapq N=int(input()) S=list(map(int,list(input().strip()))) T=list(map(int,list(input().strip()))) Q1=[] Q2=[] for i in range(N): if S[i]<T[i]: Q1.append(i) elif S[i]>T[i]: Q2.append(i) Q=int(input()) for i in range(Q): c,x,y=input().split() x=int(x)-1 y=int(y) if c=="S": S[x]=y else: T[x]=y if S[x]<T[x]: heapq.heappush(Q1,x) elif S[x]>T[x]: heapq.heappush(Q2,x) while Q1 and S[Q1[0]]>=T[Q1[0]]: heapq.heappop(Q1) while Q2 and S[Q2[0]]<=T[Q2[0]]: heapq.heappop(Q2) if Q1 and Q2: if Q1[0]<Q2[0]: print("<") elif Q2[0]<Q1[0]: print(">") elif Q1: print("<") elif Q2: print(">") else: print("=")