結果

問題 No.153 石の山
ユーザー gr1msl3ygr1msl3y
提出日時 2022-01-29 13:09:42
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 76 ms / 5,000 ms
コード長 324 bytes
コンパイル時間 784 ms
コンパイル使用メモリ 87,008 KB
実行使用メモリ 71,516 KB
最終ジャッジ日時 2023-08-30 10:48:55
合計ジャッジ時間 5,087 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
71,308 KB
testcase_01 AC 73 ms
71,252 KB
testcase_02 AC 71 ms
71,284 KB
testcase_03 AC 74 ms
71,144 KB
testcase_04 AC 72 ms
71,196 KB
testcase_05 AC 72 ms
71,012 KB
testcase_06 AC 72 ms
71,164 KB
testcase_07 AC 71 ms
71,012 KB
testcase_08 AC 72 ms
71,516 KB
testcase_09 AC 73 ms
71,256 KB
testcase_10 AC 73 ms
71,156 KB
testcase_11 AC 71 ms
71,256 KB
testcase_12 AC 73 ms
71,288 KB
testcase_13 AC 72 ms
71,016 KB
testcase_14 AC 70 ms
71,196 KB
testcase_15 AC 70 ms
71,212 KB
testcase_16 AC 71 ms
71,236 KB
testcase_17 AC 72 ms
71,372 KB
testcase_18 AC 70 ms
71,368 KB
testcase_19 AC 74 ms
71,012 KB
testcase_20 AC 76 ms
71,372 KB
testcase_21 AC 76 ms
71,280 KB
testcase_22 AC 74 ms
71,220 KB
testcase_23 AC 72 ms
71,036 KB
testcase_24 AC 73 ms
71,196 KB
testcase_25 AC 72 ms
71,244 KB
testcase_26 AC 71 ms
71,008 KB
testcase_27 AC 72 ms
71,248 KB
testcase_28 AC 73 ms
71,396 KB
testcase_29 AC 73 ms
71,388 KB
testcase_30 AC 73 ms
71,472 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
gr = [-1]*(N+1)
gr[1] = 0
for i in range(2, N+1):
    S = {gr[i//2] ^ gr[i-i//2]}
    if i > 2:
        if i % 3 == 1:
            S.add(gr[i//3+1])
        else:
            S.add(gr[i//3])
    for j in range(3):
        if j not in S:
            gr[i] = j
            break

print('A' if gr[N] else 'B')
0