結果

問題 No.2813 Cookie
ユーザー chineristACchineristAC
提出日時 2024-07-19 22:36:47
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 119 ms / 2,000 ms
コード長 692 bytes
コンパイル時間 192 ms
コンパイル使用メモリ 82,284 KB
実行使用メモリ 77,696 KB
最終ジャッジ日時 2024-07-19 22:36:51
合計ジャッジ時間 4,484 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 30
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
from itertools import permutations
from heapq import heappop,heappush
from collections import deque
import random
import bisect

input = lambda :sys.stdin.readline().rstrip()
mi = lambda :map(int,input().split())
li = lambda :list(mi())

G = [0,1,1,2,2,4,4]

def calc_grundy(a):
    if a <= 6:
        return G[a]
    
    """
    (1,1,2,2,4,4)
    (4n+6,4n+8,4n+8) n = 1,2,...
    """
    n = (a-6+2)//3
    if (a-6) % 3 == 1:
        return 4 * n + 2
    else:
        return 4 * n + 4
    

                        

for _ in range(int(input())):
    N = int(input())
    A = li()

    g = 0
    for a in A:
        g ^= calc_grundy(a)
    
    print("Alice" if g!=0 else "Bob")
0