結果
問題 | No.1506 Unbalanced Pocky Game |
ユーザー | chineristAC |
提出日時 | 2021-05-15 13:19:07 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 102 ms / 2,000 ms |
コード長 | 1,561 bytes |
コンパイル時間 | 649 ms |
コンパイル使用メモリ | 82,176 KB |
実行使用メモリ | 104,464 KB |
最終ジャッジ日時 | 2024-10-03 01:02:10 |
合計ジャッジ時間 | 8,493 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 54 ms
55,808 KB |
testcase_01 | AC | 50 ms
55,808 KB |
testcase_02 | AC | 51 ms
55,808 KB |
testcase_03 | AC | 57 ms
64,896 KB |
testcase_04 | AC | 74 ms
86,528 KB |
testcase_05 | AC | 77 ms
89,600 KB |
testcase_06 | AC | 70 ms
80,000 KB |
testcase_07 | AC | 67 ms
74,752 KB |
testcase_08 | AC | 69 ms
79,616 KB |
testcase_09 | AC | 79 ms
90,112 KB |
testcase_10 | AC | 83 ms
92,672 KB |
testcase_11 | AC | 65 ms
74,880 KB |
testcase_12 | AC | 63 ms
73,728 KB |
testcase_13 | AC | 61 ms
68,224 KB |
testcase_14 | AC | 65 ms
75,136 KB |
testcase_15 | AC | 63 ms
72,320 KB |
testcase_16 | AC | 79 ms
90,112 KB |
testcase_17 | AC | 66 ms
76,544 KB |
testcase_18 | AC | 63 ms
71,296 KB |
testcase_19 | AC | 60 ms
69,760 KB |
testcase_20 | AC | 80 ms
92,928 KB |
testcase_21 | AC | 62 ms
73,756 KB |
testcase_22 | AC | 69 ms
81,920 KB |
testcase_23 | AC | 48 ms
55,936 KB |
testcase_24 | AC | 48 ms
56,064 KB |
testcase_25 | AC | 86 ms
101,248 KB |
testcase_26 | AC | 98 ms
104,320 KB |
testcase_27 | AC | 97 ms
104,104 KB |
testcase_28 | AC | 95 ms
103,808 KB |
testcase_29 | AC | 97 ms
103,680 KB |
testcase_30 | AC | 98 ms
104,448 KB |
testcase_31 | AC | 100 ms
104,192 KB |
testcase_32 | AC | 97 ms
104,192 KB |
testcase_33 | AC | 102 ms
104,464 KB |
testcase_34 | AC | 98 ms
104,224 KB |
testcase_35 | AC | 99 ms
104,088 KB |
testcase_36 | AC | 49 ms
56,064 KB |
testcase_37 | AC | 48 ms
56,320 KB |
testcase_38 | AC | 49 ms
56,192 KB |
testcase_39 | AC | 48 ms
55,680 KB |
testcase_40 | AC | 49 ms
55,936 KB |
testcase_41 | AC | 50 ms
55,936 KB |
testcase_42 | AC | 49 ms
55,936 KB |
testcase_43 | AC | 49 ms
56,192 KB |
testcase_44 | AC | 49 ms
56,192 KB |
testcase_45 | AC | 48 ms
55,808 KB |
testcase_46 | AC | 72 ms
78,336 KB |
testcase_47 | AC | 63 ms
69,248 KB |
testcase_48 | AC | 62 ms
70,400 KB |
testcase_49 | AC | 75 ms
80,256 KB |
testcase_50 | AC | 70 ms
77,824 KB |
testcase_51 | AC | 76 ms
80,000 KB |
testcase_52 | AC | 71 ms
76,416 KB |
testcase_53 | AC | 77 ms
83,456 KB |
testcase_54 | AC | 67 ms
71,424 KB |
testcase_55 | AC | 63 ms
69,632 KB |
testcase_56 | AC | 59 ms
69,204 KB |
testcase_57 | AC | 70 ms
78,208 KB |
testcase_58 | AC | 64 ms
69,120 KB |
testcase_59 | AC | 57 ms
66,560 KB |
testcase_60 | AC | 65 ms
73,216 KB |
testcase_61 | AC | 69 ms
77,952 KB |
testcase_62 | AC | 66 ms
75,136 KB |
testcase_63 | AC | 62 ms
71,424 KB |
testcase_64 | AC | 76 ms
80,000 KB |
testcase_65 | AC | 68 ms
72,832 KB |
ソースコード
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")