結果
| 問題 | No.1439 Let's Compare!!!! | 
| コンテスト | |
| ユーザー |  googol_S0 | 
| 提出日時 | 2021-03-26 21:59:06 | 
| 言語 | PyPy3 (7.3.15) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 1,049 ms / 2,000 ms | 
| コード長 | 1,287 bytes | 
| コンパイル時間 | 194 ms | 
| コンパイル使用メモリ | 81,920 KB | 
| 実行使用メモリ | 141,892 KB | 
| 最終ジャッジ日時 | 2024-11-29 08:46:33 | 
| 合計ジャッジ時間 | 10,900 ms | 
| ジャッジサーバーID (参考情報) | judge3 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 2 | 
| other | AC * 17 | 
ソースコード
from copy import *
def init(N,node,A,unit,func):
  n=1
  while n<N:
    n<<=1
  for i in range(n*2-1):
    if len(node)<=i:
      node.append(deepcopy(unit))
    else:
      node[i]=deepcopy(unit)
  for i in range(len(A)):
    node[n-1+i]=deepcopy(A[i])
  for i in range(n-2,-1,-1):
    node[i]=func(node[(i<<1)+1],node[(i<<1)+2])
  node.append(func)
  node.append(unit)
  node.append(n)
def upd(node,x,a):
  y=node[-1]+x
  node[y-1]=a
  while y>1:
    y=y>>1
    node[y-1]=node[-3](node[(y<<1)-1],node[y<<1])
def query(node,l,r):
  x,y=l,r
  z=node[-1]-1
  rr=deepcopy(node[-2])
  rl=deepcopy(node[-2])
  while True:
    if x==y:
      return node[-3](rl,rr)
    if x&1:
      rl=node[-3](rl,node[x+z])
      x+=1
    if y&1:
      rr=node[-3](node[y+z-1],rr)
    if z==0:
      return node[-3](rl,rr)
    x>>=1
    y>>=1
    z>>=1
N=int(input())
S=list(input())
T=list(input())
for i in range(N):
  S[i]=int(S[i])
  T[i]=int(T[i])
seg=[]
def f(x,y):
  if x==0:
    return y
  else:
    return x
init(N,seg,[S[i]-T[i] for i in range(N)],0,f)
Q=int(input())
for i in range(Q):
  c,x,y=input().split()
  x,y=int(x)-1,int(y)
  if c=='S':
    S[x]=y
  else:
    T[x]=y
  upd(seg,x,S[x]-T[x])
  A=query(seg,0,N)
  if A==0:
    print('=')
  elif A<0:
    print('<')
  else:
    print('>')
            
            
            
        