結果
問題 |
No.2813 Cookie
|
ユーザー |
![]() |
提出日時 | 2024-07-20 00:21:58 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 142 ms / 2,000 ms |
コード長 | 787 bytes |
コンパイル時間 | 181 ms |
コンパイル使用メモリ | 82,364 KB |
実行使用メモリ | 76,912 KB |
最終ジャッジ日時 | 2024-07-20 00:22:05 |
合計ジャッジ時間 | 4,053 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 30 |
ソースコード
def popcount(n): c=(n&0x5555555555555555)+((n>>1)&0x5555555555555555) c=(c&0x3333333333333333)+((c>>2)&0x3333333333333333) c=(c&0x0f0f0f0f0f0f0f0f)+((c>>4)&0x0f0f0f0f0f0f0f0f) c=(c&0x00ff00ff00ff00ff)+((c>>8)&0x00ff00ff00ff00ff) c=(c&0x0000ffff0000ffff)+((c>>16)&0x0000ffff0000ffff) c=(c&0x00000000ffffffff)+((c>>32)&0x00000000ffffffff) return c T = int(input()) Alice = 'Alice' Bob = 'Bob' def grundy(x): if x == 1 or x == 2: return 1 elif x == 3 or x == 4: return 2 elif x % 3 == 1: return ((x - 2) // 3) * 4 + 2 else: return ((x - 2) // 3) * 4 for _ in range(T): N = int(input()) A = list(map(int,input().split())) g = 0 for a in A: g ^= grundy(a) if g > 0: print(Alice) else: print(Bob)