結果
| 問題 |
No.153 石の山
|
| コンテスト | |
| ユーザー |
rlangevin
|
| 提出日時 | 2023-07-12 08:59:57 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 397 bytes |
| コンパイル時間 | 150 ms |
| コンパイル使用メモリ | 82,028 KB |
| 実行使用メモリ | 58,716 KB |
| 最終ジャッジ日時 | 2024-09-13 22:55:44 |
| 合計ジャッジ時間 | 2,630 ms |
|
ジャッジサーバーID (参考情報) |
judge6 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 20 WA * 7 |
ソースコード
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")
rlangevin