結果

問題 No.3460 Chocolate Divide Game
コンテスト
ユーザー i_taku
提出日時 2026-03-02 16:57:29
言語 PyPy3
(7.3.17)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 332 ms / 2,000 ms
コード長 628 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 4,039 ms
コンパイル使用メモリ 85,736 KB
実行使用メモリ 81,368 KB
最終ジャッジ日時 2026-03-02 16:57:43
合計ジャッジ時間 5,390 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 7
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

def naive(n):
    dp = [[False] * (n + 1) for _ in range(2)]
    vis = [[False] * (n + 1) for _ in range(2)]
    def dfs(x, t):
        if vis[t][x]:
            return dp[t][x]
        if x == 1:
            return False
        vis[t][x] = True
        res = False
        for k in range((x + 1) // 2, x):
            res |= not dfs(k, 1 - t)
            if res:
                break
        dp[t][x] = res
        return dp[t][x]
    dfs(n, 0)
    return dfs(n, 0)

Q = int(input())
for _ in range(Q):
    N = int(input())
    # print("Alice" if naive(N) else "Bob")
    print("Alice" if (N + 1).bit_count() != 1 else "Bob")
0