結果

問題 No.2080 Simple Nim Query
ユーザー sasa8uyauya
提出日時 2025-07-05 01:33:13
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 682 bytes
コンパイル時間 345 ms
コンパイル使用メモリ 82,584 KB
実行使用メモリ 105,716 KB
最終ジャッジ日時 2025-07-05 01:33:33
合計ジャッジ時間 17,488 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 3 WA * 4 TLE * 1
権限があれば一括ダウンロードができます

ソースコード

diff #

B=448
st1=[0]*B*B
st2=[0]*B
n,Q=map(int,input().split())
a=list(map(int,input().split()))
for i in range(n):
  st1[i]=a[i]
for i in range(B):
  st2[i]=max(st1[i*B:i*B+B])
for _ in range(Q):
  t,x,y=map(int,input().split())
  if t==1:
    x-=1
    st1[x]=y
    i=x//B
    st2[i]=max(st1[i*B:i*B+B])
  if t==2:
    x-=1
    y-=1
    ok=0
    ng=y-x+1+1
    while ng-ok>1:
      m=(ok+ng)//2
      a=0
      l=y-m+1
      r=y
      yl=l//B
      yr=r//B
      if yl==yr:
        a=max([a]+st1[l:r+1])
      else:
        a=max([a]+st1[l:yl*B+B])
        a=max([a]+st2[yl+1:yr])
        a=max([a]+st1[yr*B:r+1])
      if a==1:
        ok=m
      else:
        ng=m
    print("FS"[ok%2])
0