結果

問題 No.153 石の山
ユーザー rlangevinrlangevin
提出日時 2023-07-12 08:59:57
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 397 bytes
コンパイル時間 367 ms
コンパイル使用メモリ 87,136 KB
実行使用メモリ 72,768 KB
最終ジャッジ日時 2023-10-11 23:04:09
合計ジャッジ時間 5,734 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 110 ms
72,316 KB
testcase_01 AC 110 ms
72,248 KB
testcase_02 AC 111 ms
72,436 KB
testcase_03 AC 112 ms
72,332 KB
testcase_04 AC 110 ms
72,068 KB
testcase_05 AC 109 ms
72,280 KB
testcase_06 AC 110 ms
72,324 KB
testcase_07 AC 110 ms
72,520 KB
testcase_08 AC 109 ms
72,272 KB
testcase_09 AC 108 ms
72,088 KB
testcase_10 AC 110 ms
72,332 KB
testcase_11 WA -
testcase_12 AC 109 ms
72,264 KB
testcase_13 AC 108 ms
72,116 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 AC 108 ms
72,216 KB
testcase_18 AC 108 ms
72,200 KB
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 110 ms
72,220 KB
testcase_23 AC 111 ms
72,200 KB
testcase_24 AC 111 ms
72,124 KB
testcase_25 AC 110 ms
72,120 KB
testcase_26 AC 109 ms
72,312 KB
testcase_27 AC 111 ms
72,160 KB
testcase_28 AC 108 ms
72,256 KB
testcase_29 AC 110 ms
72,284 KB
testcase_30 AC 112 ms
72,204 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
sys.setrecursionlimit(10**7)
from functools import lru_cache

@lru_cache(maxsize=None)
def f(n):
    if n == 1:
        return 0
    S = set()
    S.add(f(n//2)^f((n+1)//2))
    if n >= 3:
        S.add(f(n//3)^f((n+2)//3)^f((n+2)//3))
    
    now = 0
    while True:
        if now not in S:
            return now
        now += 1

N = int(input())
print("A") if f(N) else print("B")
0