結果

問題 No.1439 Let's Compare!!!!
ユーザー first_vil
提出日時 2020-11-23 23:06:09
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,036 ms / 2,000 ms
コード長 595 bytes
コンパイル時間 166 ms
コンパイル使用メモリ 82,176 KB
実行使用メモリ 114,436 KB
最終ジャッジ日時 2024-11-29 08:31:16
合計ジャッジ時間 10,529 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 17
権限があれば一括ダウンロードができます

ソースコード

diff #

def main():
  from heapq import heappop,heappush,heapify
  
  n=int(input())
  s=list(input())
  t=list(input())
  
  diff=[]
  heapify(diff)
  for i in range(n):
    if s[i]!=t[i]:
      heappush(diff,i)
  
  q=int(input())
  for _ in range(q):
    c,x,y=input().split()
    x=int(x)-1
    
    if c=='S':
      s[x]=y
    else:
      t[x]=y
    if s[x]!=t[x]:
      heappush(diff,x)
      
    k=-1
    while diff:
      j=heappop(diff)
      if s[j]!=t[j]:
        k=j
        break
    if k==-1:
      print('=')
    else:
      print('>' if s[k]>t[k] else '<')
      heappush(diff,k)
main()
0