結果

問題 No.153 石の山
ユーザー 👑 rin204rin204
提出日時 2022-09-30 23:13:32
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 383 bytes
コンパイル時間 307 ms
コンパイル使用メモリ 86,932 KB
実行使用メモリ 71,464 KB
最終ジャッジ日時 2023-08-24 16:46:20
合計ジャッジ時間 5,751 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 77 ms
70,908 KB
testcase_01 AC 75 ms
71,420 KB
testcase_02 AC 79 ms
71,088 KB
testcase_03 AC 74 ms
71,124 KB
testcase_04 AC 77 ms
71,092 KB
testcase_05 AC 78 ms
71,420 KB
testcase_06 AC 72 ms
71,084 KB
testcase_07 AC 75 ms
71,132 KB
testcase_08 WA -
testcase_09 AC 74 ms
71,312 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 75 ms
71,272 KB
testcase_17 AC 75 ms
71,208 KB
testcase_18 AC 74 ms
71,132 KB
testcase_19 AC 75 ms
71,136 KB
testcase_20 AC 75 ms
71,340 KB
testcase_21 WA -
testcase_22 AC 77 ms
71,224 KB
testcase_23 WA -
testcase_24 AC 76 ms
71,220 KB
testcase_25 WA -
testcase_26 AC 76 ms
71,172 KB
testcase_27 AC 75 ms
71,092 KB
testcase_28 AC 76 ms
71,136 KB
testcase_29 AC 75 ms
71,072 KB
testcase_30 AC 75 ms
71,288 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())

grundy = [0] * (n + 1)
grundy[1] = 0
for i in range(2, n + 1):
    a = n // 2
    b = (n + 1) // 2
    x = grundy[a] ^ grundy[b]

    a = n // 3
    b = (n + 1) // 3
    c = (n + 2) // 3
    y = grundy[a] ^ grundy[b] ^ grundy[c]

    mex = 0
    while mex == x or mex == y:
        mex += 1
    grundy[i] = mex
if grundy[n] == 0:
    print("B")
else:
    print("A")
0