結果

問題 No.2165 Let's Play Nim!
ユーザー 👑 KazunKazun
提出日時 2022-12-16 00:33:41
言語 PyPy3
(7.3.13)
結果
AC  
実行時間 367 ms / 2,000 ms
コード長 954 bytes
コンパイル時間 1,108 ms
コンパイル使用メモリ 86,928 KB
実行使用メモリ 95,968 KB
平均クエリ数 863.56
最終ジャッジ日時 2023-08-09 09:50:01
合計ジャッジ時間 28,171 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 123 ms
87,788 KB
testcase_01 AC 306 ms
95,968 KB
testcase_02 AC 308 ms
95,708 KB
testcase_03 AC 259 ms
95,676 KB
testcase_04 AC 120 ms
87,656 KB
testcase_05 AC 140 ms
92,464 KB
testcase_06 AC 138 ms
92,184 KB
testcase_07 AC 134 ms
91,896 KB
testcase_08 AC 265 ms
95,604 KB
testcase_09 AC 126 ms
87,684 KB
testcase_10 AC 160 ms
93,964 KB
testcase_11 AC 309 ms
95,932 KB
testcase_12 AC 294 ms
95,848 KB
testcase_13 AC 117 ms
87,184 KB
testcase_14 AC 136 ms
92,000 KB
testcase_15 AC 126 ms
88,220 KB
testcase_16 AC 287 ms
95,848 KB
testcase_17 AC 224 ms
94,244 KB
testcase_18 AC 367 ms
95,584 KB
testcase_19 AC 118 ms
87,424 KB
testcase_20 AC 132 ms
92,128 KB
testcase_21 AC 212 ms
93,996 KB
testcase_22 AC 196 ms
95,268 KB
testcase_23 AC 193 ms
95,164 KB
testcase_24 AC 176 ms
93,492 KB
testcase_25 AC 250 ms
95,856 KB
testcase_26 AC 313 ms
95,932 KB
testcase_27 AC 201 ms
94,736 KB
testcase_28 AC 230 ms
94,128 KB
testcase_29 AC 118 ms
87,276 KB
testcase_30 AC 116 ms
87,872 KB
testcase_31 AC 115 ms
87,576 KB
testcase_32 AC 274 ms
94,036 KB
evil_2_big_1.txt TLE -
evil_2_big_2.txt TLE -
evil_2_big_3.txt TLE -
evil_big_1.txt TLE -
evil_big_2.txt TLE -
evil_big_3.txt TLE -
権限があれば一括ダウンロードができます

ソースコード

diff #

#==================================================
def send(i,k):
    print(i,k, flush=True)

def recieve():
    i,k=map(int,input().split())
    return i,k

def phase():
    return int(input())

def choice(turn):
    print(turn, flush=True)

#==================================================
def solve():
    from collections import defaultdict

    N=int(input())
    A=[0]+list(map(int,input().split()))

    grundy=0
    for a in A[1:]:
        grundy^=a

    turn=1 if grundy else 0
    choice(turn)

    while True:
        if turn:
            msb=1<<(grundy.bit_length()-1)
            for i in range(N+1):
                if msb&A[i]==msb:
                    break
            h=grundy^A[i]
            k=A[i]-h
            send(i,k)
        else:
            i,k=recieve()

        grundy^=A[i]^(A[i]-k)
        A[i]-=k
        if phase()==-1:
            return
        turn^=1

#==================================================
solve()
0