結果
| 問題 |
No.1439 Let's Compare!!!!
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-06-10 10:03:13 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
RE
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 1,210 bytes |
| コンパイル時間 | 159 ms |
| コンパイル使用メモリ | 82,012 KB |
| 実行使用メモリ | 94,492 KB |
| 最終ジャッジ日時 | 2024-11-29 15:38:01 |
| 合計ジャッジ時間 | 2,731 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 6 RE * 11 |
ソースコード
import heapq
class pqheap:
def __init__(self,key=None):
self.p = list()
self.q = list()
def insert(self,x):
heapq.heappush(self.p, x)
return
def erase(self,x):
heapq.heappush(self.q, x)
return
def minimum(self):
while self.q and self.p[0] == self.q[0]:
heapq.heappop(self.p)
heapq.heappop(self.q)
return self.p[0] if len(self.p)>0 else None
def main1(n,s,t,sary,tary,query):
pq=pqheap()
ret=[]
for i in range(n):
if sary[i]!=tary[i]:
pq.insert(i)
for tmp in query:
c,x,y=tmp.split()
x=int(x)-1
y=int(y)
if sary[x]!=tary[x]:
pq.erase(x)
if c=="S":
sary[x]=y
else:
tary[x]=y
if sary[x]!=tary[x]:
pq.insert(x)
idx=pq.minimum()
if idx is None:
ret.append("=")
elif sary[idx]<tary[idx]:
ret.append("<")
elif sary[idx]>tary[idx]:
ret.append(">")
#print(sary,tary,idx)
return ret
if __name__=='__main__':
n=int(input())
s=input()
sary=list(map(int,list(s)))
s=int(s)
t=input()
tary=list(map(int,list(t)))
t=int(t)
q=int(input())
query=[input() for _ in range(q)]
ret1=main1(n,s,t,sary[:],tary[:],query[:])
print(*ret1,sep="\n")