結果

問題 No.2165 Let's Play Nim!
ユーザー mkawa2mkawa2
提出日時 2022-12-19 00:59:55
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 412 ms / 2,000 ms
コード長 751 bytes
コンパイル時間 1,294 ms
コンパイル使用メモリ 87,256 KB
実行使用メモリ 97,288 KB
平均クエリ数 884.90
最終ジャッジ日時 2023-08-11 09:23:18
合計ジャッジ時間 22,596 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 96 ms
86,800 KB
testcase_01 AC 364 ms
95,272 KB
testcase_02 AC 393 ms
97,288 KB
testcase_03 AC 333 ms
95,292 KB
testcase_04 AC 101 ms
91,492 KB
testcase_05 AC 127 ms
92,168 KB
testcase_06 AC 125 ms
91,348 KB
testcase_07 AC 119 ms
91,576 KB
testcase_08 AC 345 ms
95,352 KB
testcase_09 AC 109 ms
92,320 KB
testcase_10 AC 137 ms
91,788 KB
testcase_11 AC 387 ms
96,912 KB
testcase_12 AC 350 ms
95,532 KB
testcase_13 AC 101 ms
91,636 KB
testcase_14 AC 125 ms
91,716 KB
testcase_15 AC 106 ms
91,760 KB
testcase_16 AC 371 ms
95,880 KB
testcase_17 AC 272 ms
94,760 KB
testcase_18 AC 412 ms
97,136 KB
testcase_19 AC 100 ms
91,924 KB
testcase_20 AC 118 ms
92,252 KB
testcase_21 AC 211 ms
94,136 KB
testcase_22 AC 189 ms
94,044 KB
testcase_23 AC 166 ms
93,036 KB
testcase_24 AC 156 ms
92,984 KB
testcase_25 AC 292 ms
95,860 KB
testcase_26 AC 374 ms
95,464 KB
testcase_27 AC 205 ms
93,924 KB
testcase_28 AC 276 ms
94,860 KB
testcase_29 AC 95 ms
87,272 KB
testcase_30 AC 93 ms
87,512 KB
testcase_31 AC 93 ms
87,468 KB
testcase_32 AC 258 ms
94,152 KB
evil_2_big_1.txt AC 1,711 ms
97,684 KB
evil_2_big_2.txt AC 1,876 ms
100,420 KB
evil_2_big_3.txt AC 1,691 ms
97,816 KB
evil_big_1.txt AC 1,852 ms
99,332 KB
evil_big_2.txt AC 1,892 ms
99,748 KB
evil_big_3.txt AC 1,871 ms
100,868 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

ii = [set() for _ in range(18)]
def push(i, a):
    aa[i] = a
    for j in range(18):
        if a & 1: ii[j].add(i)
        a >>= 1

def get(x):
    j = x.bit_length()-1
    i = ii[j].pop()
    rem(i)
    return i

def rem(i):
    for j in range(18):
        ii[j].discard(i)

x = 0
for i, a in enumerate(aa):
    x ^= a
    push(i, a)

t = 1 if x else 0
print(t, flush=True)

ret = 0
while ret == 0:
    if t:
        i = get(x)
        a = aa[i]
        b = x ^ a
        k = a-b
        print(i+1, k, flush=True)
    else:
        i, k = map(int, input().split())
        i -= 1
        a = aa[i]
        rem(i)
        b = a-k
    x ^= a ^ b
    push(i, b)
    ret = int(input())
    t ^= 1
0