結果

問題 No.1506 Unbalanced Pocky Game
ユーザー c-yanc-yan
提出日時 2021-05-14 23:02:49
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 613 bytes
コンパイル時間 264 ms
コンパイル使用メモリ 12,800 KB
実行使用メモリ 51,532 KB
最終ジャッジ日時 2024-04-10 02:22:54
合計ジャッジ時間 8,658 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 31 ms
10,752 KB
testcase_01 AC 31 ms
10,752 KB
testcase_02 AC 29 ms
10,880 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 53 ms
15,872 KB
testcase_14 AC 83 ms
22,032 KB
testcase_15 AC 74 ms
20,168 KB
testcase_16 AC 156 ms
37,772 KB
testcase_17 AC 87 ms
23,552 KB
testcase_18 AC 64 ms
18,696 KB
testcase_19 AC 60 ms
17,360 KB
testcase_20 AC 158 ms
38,444 KB
testcase_21 AC 79 ms
21,100 KB
testcase_22 AC 112 ms
28,612 KB
testcase_23 WA -
testcase_24 WA -
testcase_25 AC 213 ms
48,316 KB
testcase_26 AC 234 ms
50,820 KB
testcase_27 AC 234 ms
51,492 KB
testcase_28 AC 232 ms
49,848 KB
testcase_29 AC 231 ms
50,384 KB
testcase_30 AC 233 ms
51,528 KB
testcase_31 AC 233 ms
51,532 KB
testcase_32 AC 230 ms
51,044 KB
testcase_33 AC 228 ms
50,740 KB
testcase_34 AC 237 ms
49,688 KB
testcase_35 AC 226 ms
49,664 KB
testcase_36 AC 30 ms
10,752 KB
testcase_37 AC 32 ms
10,880 KB
testcase_38 AC 29 ms
10,752 KB
testcase_39 AC 29 ms
10,880 KB
testcase_40 AC 29 ms
10,752 KB
testcase_41 AC 29 ms
10,752 KB
testcase_42 AC 31 ms
10,752 KB
testcase_43 AC 30 ms
10,752 KB
testcase_44 AC 29 ms
10,752 KB
testcase_45 AC 28 ms
10,880 KB
testcase_46 AC 95 ms
24,736 KB
testcase_47 AC 52 ms
15,488 KB
testcase_48 AC 57 ms
16,812 KB
testcase_49 AC 108 ms
27,112 KB
testcase_50 AC 96 ms
24,948 KB
testcase_51 AC 106 ms
26,524 KB
testcase_52 AC 89 ms
23,436 KB
testcase_53 AC 121 ms
29,716 KB
testcase_54 AC 65 ms
18,420 KB
testcase_55 AC 53 ms
15,596 KB
testcase_56 AC 51 ms
15,488 KB
testcase_57 AC 98 ms
24,768 KB
testcase_58 AC 51 ms
15,192 KB
testcase_59 AC 41 ms
13,312 KB
testcase_60 AC 69 ms
19,456 KB
testcase_61 AC 95 ms
24,356 KB
testcase_62 AC 83 ms
22,364 KB
testcase_63 AC 68 ms
19,072 KB
testcase_64 AC 105 ms
26,576 KB
testcase_65 AC 74 ms
19,768 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from sys import setrecursionlimit

setrecursionlimit(10 ** 6)

N, *A = map(int, open(0).read().split())

cache = [[None] * (N + 1) for _ in range(2)]

def f(i, turn):
    if i == -1:
        return turn ^ 1

    if cache[turn][i] is not None:
        return cache[turn][i]

    if A[i - 1] == 1:
        t = f(i - 1, turn ^ 1)
        cache[turn][i] = t
        return t

    t = f(i - 1, turn)
    if t == turn:
        cache[turn][i] = t
        return t
    t = f(i - 1, turn ^ 1)
    cache[turn][i] = t
    return t


# turn = 0 Alice
# turn = 1 Bob
if f(N, 0) == 0:
    print('Alice')
else:
    print('Bob')
0