結果

問題 No.1506 Unbalanced Pocky Game
ユーザー kuro_Bkuro_B
提出日時 2023-05-16 10:35:13
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 565 ms / 2,000 ms
コード長 1,616 bytes
コンパイル時間 753 ms
コンパイル使用メモリ 11,052 KB
実行使用メモリ 268,076 KB
最終ジャッジ日時 2023-08-21 03:45:02
合計ジャッジ時間 18,666 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 36 ms
10,760 KB
testcase_01 AC 37 ms
10,616 KB
testcase_02 AC 37 ms
10,552 KB
testcase_03 AC 49 ms
18,060 KB
testcase_04 AC 232 ms
112,336 KB
testcase_05 AC 262 ms
129,640 KB
testcase_06 AC 173 ms
81,860 KB
testcase_07 AC 132 ms
61,360 KB
testcase_08 AC 180 ms
85,120 KB
testcase_09 AC 273 ms
135,136 KB
testcase_10 AC 275 ms
137,608 KB
testcase_11 AC 134 ms
63,504 KB
testcase_12 AC 125 ms
57,540 KB
testcase_13 AC 79 ms
34,348 KB
testcase_14 AC 134 ms
62,284 KB
testcase_15 AC 118 ms
53,704 KB
testcase_16 AC 273 ms
133,324 KB
testcase_17 AC 147 ms
68,512 KB
testcase_18 AC 105 ms
46,472 KB
testcase_19 AC 92 ms
40,896 KB
testcase_20 AC 274 ms
136,812 KB
testcase_21 AC 124 ms
57,900 KB
testcase_22 AC 195 ms
92,208 KB
testcase_23 AC 35 ms
10,620 KB
testcase_24 AC 34 ms
10,696 KB
testcase_25 AC 366 ms
181,152 KB
testcase_26 AC 564 ms
260,976 KB
testcase_27 AC 559 ms
265,036 KB
testcase_28 AC 536 ms
254,540 KB
testcase_29 AC 546 ms
257,184 KB
testcase_30 AC 565 ms
265,348 KB
testcase_31 AC 559 ms
268,076 KB
testcase_32 AC 556 ms
261,068 KB
testcase_33 AC 557 ms
260,332 KB
testcase_34 AC 540 ms
254,088 KB
testcase_35 AC 551 ms
254,316 KB
testcase_36 AC 37 ms
10,872 KB
testcase_37 AC 38 ms
11,056 KB
testcase_38 AC 37 ms
10,744 KB
testcase_39 AC 37 ms
10,856 KB
testcase_40 AC 37 ms
10,768 KB
testcase_41 AC 37 ms
10,856 KB
testcase_42 AC 38 ms
10,936 KB
testcase_43 AC 37 ms
10,932 KB
testcase_44 AC 37 ms
10,876 KB
testcase_45 AC 37 ms
10,784 KB
testcase_46 AC 218 ms
98,032 KB
testcase_47 AC 94 ms
39,988 KB
testcase_48 AC 112 ms
48,496 KB
testcase_49 AC 250 ms
113,532 KB
testcase_50 AC 221 ms
100,160 KB
testcase_51 AC 240 ms
110,052 KB
testcase_52 AC 196 ms
87,692 KB
testcase_53 AC 279 ms
129,092 KB
testcase_54 AC 125 ms
55,120 KB
testcase_55 AC 95 ms
40,996 KB
testcase_56 AC 94 ms
40,144 KB
testcase_57 AC 218 ms
98,604 KB
testcase_58 AC 91 ms
38,508 KB
testcase_59 AC 67 ms
26,712 KB
testcase_60 AC 142 ms
63,384 KB
testcase_61 AC 213 ms
94,948 KB
testcase_62 AC 177 ms
79,392 KB
testcase_63 AC 133 ms
59,120 KB
testcase_64 AC 243 ms
109,736 KB
testcase_65 AC 147 ms
65,612 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

###スニペット始まり###
import sys, re
from copy import copy, deepcopy
from math import ceil, floor, sqrt,factorial, gcd, pi, degrees, radians, sin, asin, cos, acos, tan, atan2
from statistics import mean, median
from collections import Counter, deque, defaultdict
from heapq import heapify, heappop, heappush
from itertools import permutations, accumulate, product, combinations, combinations_with_replacement
from bisect import bisect, bisect_left, bisect_right
from functools import reduce, lru_cache
from string import ascii_uppercase, ascii_lowercase
from decimal import Decimal, ROUND_HALF_UP #四捨五入用

def input(): return sys.stdin.readline().rstrip('\n')
#easy-testのpypyでは再帰数を下げる。
if __file__=='prog.py':
    sys.setrecursionlimit(10**5)
else:
    sys.setrecursionlimit(10**6)

def lcm(a, b): return a * b // gcd(a, b)

#3つ以上の最大公約数/最小公倍数。Nを要素数、Mを数値の大きさとして、O(NlogM)
def gcd_v2(l: list): return reduce(gcd, l)
def lcm_v2(l: list): return reduce(lcm, l)

#nPk
def nPk(n, k): return factorial(n) // factorial(n - k)

#逆元
def modinv(a, mod=10**9+7): return pow(a, mod-2, mod)
INF = float('inf')
MOD = 10 ** 9 + 7
###スニペット終わり###

N=int(input())
A=list(map(int, input().split()))

#先手が勝つか。
@lru_cache(None)
def rec(n,state):
    if n==1:
        return True
    else:
        if state==1:
            return not rec(n-1,min(A[n-2], 2))
        else:
            return (not rec(n,1))|(not rec(n-1,min(A[n-2], 2)))

if rec(N,min(A[N-1], 2)):
    print('Alice')
else:
    print('Bob')
0