結果

問題 No.1439 Let's Compare!!!!
ユーザー marroncastle
提出日時 2021-03-30 11:18:45
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 589 ms / 2,000 ms
コード長 621 bytes
コンパイル時間 522 ms
コンパイル使用メモリ 82,120 KB
実行使用メモリ 114,672 KB
最終ジャッジ日時 2024-11-30 08:30:42
合計ジャッジ時間 7,728 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 17
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
S = list(map(int,list(input())))
T = list(map(int,list(input())))
from heapq import *
lis = []
for i in range(N):
  if S[i]!=T[i]:
    heappush(lis, i)
Q = int(input())
ans = ['=']*Q
for i in range(Q):
  c,x,y = input().split()
  x = int(x); y = int(y)
  flag = S[x-1]==T[x-1]
  if c=='S':
    S[x-1] = y
  else:
    T[x-1] = y
  if flag and S[x-1] != T[x-1]:
    heappush(lis, x-1)
  while len(lis):
    ind = heappop(lis)
    if S[ind]>T[ind]:
      ans[i] = '>'
      heappush(lis, ind)
      break
    elif S[ind]<T[ind]:
      ans[i] = '<'
      heappush(lis, ind)
      break
print(*ans, sep='\n')
0