結果

問題 No.2165 Let's Play Nim!
コンテスト
ユーザー meruuu61779999
提出日時 2023-04-13 00:25:26
言語 PyPy3
(7.3.17)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 151 ms / 2,000 ms
コード長 690 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 219 ms
コンパイル使用メモリ 85,248 KB
実行使用メモリ 101,792 KB
平均クエリ数 863.56
最終ジャッジ日時 2026-04-25 05:11:56
合計ジャッジ時間 14,448 ms
ジャッジサーバーID
(参考情報)
judge2_1 / judge1_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 38
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

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

nim = 0
for a in A:
    nim ^= a
t = 1 if nim else 0
print(t, flush=True)
if t == 0:
    idx, k = map(int, input().split())
    idx -= 1
    nim = A[idx]
    A[idx] -= k
    nim ^= A[idx]

    ret = int(input())
    if ret == -1:
        exit()

while True:
    for i, a in enumerate(A):
        na = a ^ nim
        if na < a:
            A[i] -= a - na
            print(i + 1, a - na, flush=True)
            break

    ret = int(input())
    if ret == -1:
        exit()

    idx, k = map(int, input().split())
    idx -= 1
    nim = A[idx]
    A[idx] -= k
    nim ^= A[idx]

    ret = int(input())
    if ret == -1:
        exit()
0