結果
| 問題 | 
                            No.2165 Let's Play Nim!
                             | 
                    
| コンテスト | |
| ユーザー | 
                             titia
                         | 
                    
| 提出日時 | 2022-12-16 02:05:03 | 
| 言語 | PyPy3  (7.3.15)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 305 ms / 2,000 ms | 
| コード長 | 672 bytes | 
| コンパイル時間 | 480 ms | 
| コンパイル使用メモリ | 82,528 KB | 
| 実行使用メモリ | 93,984 KB | 
| 平均クエリ数 | 863.56 | 
| 最終ジャッジ日時 | 2024-11-14 18:54:49 | 
| 合計ジャッジ時間 | 25,032 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge3 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 1 | 
| other | AC * 32 TLE * 6 | 
ソースコード
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]
    ret=int(input())
    if ret==-1:
        exit()
            
            
            
        
            
titia