結果

問題 No.2165 Let's Play Nim!
ユーザー meruuu61779999meruuu61779999
提出日時 2023-04-13 00:10:53
言語 PyPy3
(7.3.15)
結果
RE  
実行時間 -
コード長 783 bytes
コンパイル時間 195 ms
コンパイル使用メモリ 82,176 KB
実行使用メモリ 99,280 KB
平均クエリ数 379.56
最終ジャッジ日時 2024-04-17 08:59:53
合計ジャッジ時間 10,218 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 61 ms
68,320 KB
testcase_01 RE -
testcase_02 RE -
testcase_03 RE -
testcase_04 AC 63 ms
69,912 KB
testcase_05 AC 82 ms
78,332 KB
testcase_06 AC 79 ms
77,512 KB
testcase_07 AC 75 ms
76,232 KB
testcase_08 RE -
testcase_09 AC 63 ms
71,192 KB
testcase_10 AC 102 ms
88,300 KB
testcase_11 RE -
testcase_12 RE -
testcase_13 AC 60 ms
68,936 KB
testcase_14 AC 78 ms
76,232 KB
testcase_15 AC 69 ms
69,576 KB
testcase_16 RE -
testcase_17 RE -
testcase_18 RE -
testcase_19 AC 62 ms
70,876 KB
testcase_20 AC 72 ms
76,640 KB
testcase_21 AC 173 ms
94,808 KB
testcase_22 AC 141 ms
94,680 KB
testcase_23 AC 133 ms
94,248 KB
testcase_24 AC 121 ms
91,224 KB
testcase_25 RE -
testcase_26 RE -
testcase_27 AC 152 ms
94,520 KB
testcase_28 RE -
testcase_29 AC 61 ms
70,308 KB
testcase_30 AC 56 ms
70,264 KB
testcase_31 AC 55 ms
68,952 KB
testcase_32 RE -
evil_2_big_1.txt RE -
evil_2_big_2.txt RE -
evil_2_big_3.txt RE -
evil_big_1.txt RE -
evil_big_2.txt RE -
evil_big_3.txt RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

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)


def my_turn(nim):
    # print('myturn')
    # print(nim)
    # print(A)
    # B = sorted([(a, i) for i, a in enumerate(A)], reverse=True)
    for i,a in enumerate(A):
        na = a ^ nim
        if na < a:
            A[i] -= a - na
            print(i + 1, a - na)
            break

    ret = int(input())
    if ret == 0:
        enemy_turn()
    else:
        exit()


def enemy_turn():
    # print("enemyturn")
    # print(A)
    idx, k = map(int, input().split())
    idx -= 1
    nim=A[idx]
    A[idx] -= k
    nim^=A[idx]

    ret = int(input())
    if ret == 0:
        my_turn(nim)
    else:
        exit()


if t:
    my_turn(nim)
else:
    enemy_turn()
0