結果

問題 No.2165 Let's Play Nim!
ユーザー titia
提出日時 2022-12-16 02:03:19
言語 PyPy3
(7.3.15)
結果
RE  
実行時間 -
コード長 724 bytes
コンパイル時間 351 ms
コンパイル使用メモリ 82,108 KB
実行使用メモリ 89,972 KB
平均クエリ数 2.28
最終ジャッジ日時 2024-11-14 18:48:07
合計ジャッジ時間 7,295 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 1 RE * 37
権限があれば一括ダウンロードができます

ソースコード

diff #

n=int(input())
A=list(map(int,input().split()))

XOR=0
for a in A:
    XOR^=a

if XOR==0:
    print(0,flush=True)

    i,k=map(int,input().split())
    XOR^=A[i-1]
    A[i-1]-=k
    XOR^=A[i-1]
    ret=int(input())
    if ret==-1:
        exit()
else:
    print(1,flush=True)

while True:
    for i in range(n):
        if A[i]^XOR<A[i]:
            nec=A[i]^XOR

            print(i+1,A[i]-nec,flush=True)
            A[i]=nec
            XOR=0
            ret=int(input())
            if ret==-1:
                exit()

            break

    i,k=map(int,input().split())
    XOR^=A[i-1]
    A[i-1]-=k
    XOR^=A[i-1]
    if A[i-1]!=0:
        heappush(H,(-A[i-1],i-1))
    ret=int(input())
    if ret==-1:
        exit()
0