結果

問題 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
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 52 ms
55,168 KB
testcase_01 AC 106 ms
77,312 KB
testcase_02 AC 107 ms
77,568 KB
testcase_03 AC 105 ms
77,312 KB
testcase_04 AC 109 ms
77,312 KB
testcase_05 AC 104 ms
77,312 KB
testcase_06 AC 109 ms
77,696 KB
testcase_07 AC 110 ms
77,312 KB
testcase_08 AC 109 ms
77,440 KB
testcase_09 AC 113 ms
77,568 KB
testcase_10 AC 119 ms
77,568 KB
testcase_11 AC 91 ms
77,440 KB
testcase_12 AC 90 ms
77,312 KB
testcase_13 AC 90 ms
77,312 KB
testcase_14 AC 95 ms
77,412 KB
testcase_15 AC 80 ms
77,184 KB
testcase_16 AC 79 ms
76,928 KB
testcase_17 AC 91 ms
77,328 KB
testcase_18 AC 78 ms
76,800 KB
testcase_19 AC 92 ms
77,312 KB
testcase_20 AC 92 ms
77,312 KB
testcase_21 AC 93 ms
77,412 KB
testcase_22 AC 81 ms
76,928 KB
testcase_23 AC 93 ms
76,800 KB
testcase_24 AC 88 ms
77,184 KB
testcase_25 AC 90 ms
76,928 KB
testcase_26 AC 53 ms
55,760 KB
testcase_27 AC 54 ms
55,552 KB
testcase_28 AC 62 ms
55,936 KB
testcase_29 AC 53 ms
55,552 KB
testcase_30 AC 53 ms
55,424 KB
権限があれば一括ダウンロードができます

ソースコード

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