結果

問題 No.1506 Unbalanced Pocky Game
ユーザー ThetaTheta
提出日時 2024-03-28 19:38:18
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 107 ms / 2,000 ms
コード長 1,351 bytes
コンパイル時間 259 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 102,084 KB
最終ジャッジ日時 2024-03-28 19:38:26
合計ジャッジ時間 7,224 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 40 ms
53,460 KB
testcase_01 AC 37 ms
53,460 KB
testcase_02 AC 36 ms
53,460 KB
testcase_03 AC 46 ms
61,952 KB
testcase_04 AC 63 ms
83,292 KB
testcase_05 AC 67 ms
87,980 KB
testcase_06 AC 57 ms
77,528 KB
testcase_07 AC 56 ms
70,996 KB
testcase_08 AC 57 ms
77,568 KB
testcase_09 AC 66 ms
88,056 KB
testcase_10 AC 69 ms
90,656 KB
testcase_11 AC 76 ms
70,996 KB
testcase_12 AC 50 ms
69,980 KB
testcase_13 AC 44 ms
63,292 KB
testcase_14 AC 48 ms
70,356 KB
testcase_15 AC 48 ms
68,508 KB
testcase_16 AC 62 ms
84,628 KB
testcase_17 AC 50 ms
71,704 KB
testcase_18 AC 45 ms
65,608 KB
testcase_19 AC 44 ms
64,304 KB
testcase_20 AC 62 ms
87,096 KB
testcase_21 AC 48 ms
69,340 KB
testcase_22 AC 54 ms
76,212 KB
testcase_23 AC 37 ms
53,460 KB
testcase_24 AC 37 ms
53,460 KB
testcase_25 AC 71 ms
95,732 KB
testcase_26 AC 79 ms
102,024 KB
testcase_27 AC 79 ms
102,084 KB
testcase_28 AC 107 ms
101,940 KB
testcase_29 AC 81 ms
101,976 KB
testcase_30 AC 82 ms
102,084 KB
testcase_31 AC 79 ms
102,084 KB
testcase_32 AC 79 ms
102,024 KB
testcase_33 AC 80 ms
102,024 KB
testcase_34 AC 79 ms
101,928 KB
testcase_35 AC 79 ms
101,928 KB
testcase_36 AC 37 ms
53,460 KB
testcase_37 AC 37 ms
53,460 KB
testcase_38 AC 37 ms
53,460 KB
testcase_39 AC 36 ms
53,460 KB
testcase_40 AC 37 ms
53,460 KB
testcase_41 AC 38 ms
53,460 KB
testcase_42 AC 37 ms
53,460 KB
testcase_43 AC 37 ms
53,460 KB
testcase_44 AC 51 ms
53,460 KB
testcase_45 AC 37 ms
53,460 KB
testcase_46 AC 52 ms
72,428 KB
testcase_47 AC 43 ms
63,052 KB
testcase_48 AC 44 ms
64,112 KB
testcase_49 AC 55 ms
76,060 KB
testcase_50 AC 52 ms
72,468 KB
testcase_51 AC 55 ms
75,872 KB
testcase_52 AC 51 ms
71,212 KB
testcase_53 AC 59 ms
79,156 KB
testcase_54 AC 46 ms
66,824 KB
testcase_55 AC 44 ms
63,064 KB
testcase_56 AC 44 ms
63,056 KB
testcase_57 AC 52 ms
72,436 KB
testcase_58 AC 43 ms
62,464 KB
testcase_59 AC 41 ms
61,556 KB
testcase_60 AC 49 ms
68,080 KB
testcase_61 AC 53 ms
72,388 KB
testcase_62 AC 50 ms
69,984 KB
testcase_63 AC 47 ms
67,432 KB
testcase_64 AC 55 ms
75,876 KB
testcase_65 AC 48 ms
68,224 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

    #  [2]
    # [0]にすれば勝ち
    # [2,3]
    # [2,1]→[2,0]→[0,0]で勝ち
    # これが成り立たないのは、[2,1]のように自分に末尾1が回ってきたとき
    #
    # 1が偶数個連続しているところは取れる操作が確定するし
    # 手番が戻ってくるだけなので無視してよい
    # 1は連続しないようにできる
    # もし末尾を除いた要素が手番の人の勝ちなら、末尾を1にして渡せば勝ち盤面で手番が戻ってくる
    # もし末尾を除いた要素が手番の人の負けなら、末尾を0にして渡せば相手が負けるので勝ち
    # つまり末尾要素が2以上で、要素数が2以上なら絶対に勝ち
    # 末尾要素が1のときは、残り要素が勝ちなら自分の負け、負けなら自分が勝ち
    is_alice_win = True
    while A:
        if len(A) == 1:
            if is_alice_win:
                print("Alice")
            else:
                print("Bob")
            return
        if A[-1] > 1:
            if is_alice_win:
                print("Alice")
            else:
                print("Bob")
            return
        A.pop()
        is_alice_win = not is_alice_win


if __name__ == "__main__":
    main()
0