結果

問題 No.1506 Unbalanced Pocky Game
ユーザー chineristACchineristAC
提出日時 2021-05-15 13:19:07
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 94 ms / 2,000 ms
コード長 1,561 bytes
コンパイル時間 348 ms
コンパイル使用メモリ 82,420 KB
実行使用メモリ 104,792 KB
最終ジャッジ日時 2024-04-14 03:53:07
合計ジャッジ時間 7,738 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 46 ms
57,684 KB
testcase_01 AC 50 ms
55,980 KB
testcase_02 AC 47 ms
57,192 KB
testcase_03 AC 52 ms
66,416 KB
testcase_04 AC 70 ms
87,484 KB
testcase_05 AC 74 ms
90,812 KB
testcase_06 AC 64 ms
81,192 KB
testcase_07 AC 60 ms
75,612 KB
testcase_08 AC 66 ms
80,796 KB
testcase_09 AC 73 ms
91,256 KB
testcase_10 AC 76 ms
93,660 KB
testcase_11 AC 62 ms
76,056 KB
testcase_12 AC 60 ms
74,524 KB
testcase_13 AC 56 ms
69,472 KB
testcase_14 AC 61 ms
75,280 KB
testcase_15 AC 59 ms
72,860 KB
testcase_16 AC 73 ms
91,912 KB
testcase_17 AC 62 ms
77,492 KB
testcase_18 AC 57 ms
72,416 KB
testcase_19 AC 55 ms
71,216 KB
testcase_20 AC 75 ms
94,472 KB
testcase_21 AC 59 ms
73,816 KB
testcase_22 AC 66 ms
82,664 KB
testcase_23 AC 46 ms
57,040 KB
testcase_24 AC 45 ms
56,244 KB
testcase_25 AC 83 ms
102,184 KB
testcase_26 AC 94 ms
104,296 KB
testcase_27 AC 94 ms
104,528 KB
testcase_28 AC 93 ms
104,156 KB
testcase_29 AC 92 ms
103,704 KB
testcase_30 AC 93 ms
104,488 KB
testcase_31 AC 91 ms
104,792 KB
testcase_32 AC 94 ms
104,552 KB
testcase_33 AC 93 ms
104,712 KB
testcase_34 AC 92 ms
104,196 KB
testcase_35 AC 91 ms
103,968 KB
testcase_36 AC 46 ms
56,116 KB
testcase_37 AC 46 ms
56,740 KB
testcase_38 AC 46 ms
57,596 KB
testcase_39 AC 45 ms
57,092 KB
testcase_40 AC 46 ms
57,040 KB
testcase_41 AC 46 ms
57,660 KB
testcase_42 AC 45 ms
57,720 KB
testcase_43 AC 46 ms
56,724 KB
testcase_44 AC 45 ms
56,588 KB
testcase_45 AC 45 ms
56,224 KB
testcase_46 AC 66 ms
79,380 KB
testcase_47 AC 57 ms
69,452 KB
testcase_48 AC 59 ms
72,528 KB
testcase_49 AC 71 ms
81,308 KB
testcase_50 AC 66 ms
78,700 KB
testcase_51 AC 68 ms
80,848 KB
testcase_52 AC 65 ms
77,924 KB
testcase_53 AC 72 ms
84,748 KB
testcase_54 AC 59 ms
72,060 KB
testcase_55 AC 57 ms
70,728 KB
testcase_56 AC 58 ms
69,744 KB
testcase_57 AC 67 ms
78,988 KB
testcase_58 AC 57 ms
70,180 KB
testcase_59 AC 55 ms
67,836 KB
testcase_60 AC 62 ms
74,372 KB
testcase_61 AC 70 ms
79,048 KB
testcase_62 AC 62 ms
75,660 KB
testcase_63 AC 59 ms
72,544 KB
testcase_64 AC 68 ms
80,896 KB
testcase_65 AC 61 ms
73,240 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

class UnionFindVerSize():
    def __init__(self, N):
        self._parent = [n for n in range(0, N)]
        self._size = [1] * N
        self.group = N

    def find_root(self, x):
        if self._parent[x] == x: return x
        self._parent[x] = self.find_root(self._parent[x])
        stack = [x]
        while self._parent[stack[-1]]!=stack[-1]:
            stack.append(self._parent[stack[-1]])
        for v in stack:
            self._parent[v] = stack[-1]
        return self._parent[x]

    def unite(self, x, y):
        gx = self.find_root(x)
        gy = self.find_root(y)
        if gx == gy: return

        self.group -= 1

        if self._size[gx] < self._size[gy]:
            self._parent[gx] = gy
            self._size[gy] += self._size[gx]
        else:
            self._parent[gy] = gx
            self._size[gx] += self._size[gy]

    def get_size(self, x):
        return self._size[self.find_root(x)]

    def is_same_group(self, x, y):
        return self.find_root(x) == self.find_root(y)

import sys,random,bisect
from collections import deque,defaultdict
from heapq import heapify,heappop,heappush
from itertools import permutations
from math import log,gcd

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

N = int(input())
A = li()

grundy = [1 for i in range(N)]
for i in range(1,N):
    if grundy[i-1]==0:
        grundy[i] = 1
    else:
        if A[i]==1:
            grundy[i] = 0
        else:
            grundy[i] = 1

print("Alice" if grundy[N-1] else "Bob")
0