結果

問題 No.977 アリス仕掛けの摩天楼
ユーザー zaki_chemtechzaki_chemtech
提出日時 2020-07-10 19:42:41
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 533 bytes
コンパイル時間 152 ms
コンパイル使用メモリ 82,160 KB
実行使用メモリ 89,368 KB
最終ジャッジ日時 2024-04-19 12:10:11
合計ジャッジ時間 3,217 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
55,376 KB
testcase_01 AC 39 ms
54,068 KB
testcase_02 AC 38 ms
54,768 KB
testcase_03 AC 35 ms
54,216 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 35 ms
55,548 KB
testcase_07 AC 36 ms
55,132 KB
testcase_08 AC 37 ms
54,808 KB
testcase_09 AC 36 ms
55,572 KB
testcase_10 AC 37 ms
55,788 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 88 ms
77,992 KB
testcase_14 AC 87 ms
77,776 KB
testcase_15 AC 89 ms
77,332 KB
testcase_16 AC 89 ms
77,388 KB
testcase_17 WA -
testcase_18 AC 109 ms
80,328 KB
testcase_19 AC 109 ms
80,672 KB
testcase_20 AC 139 ms
82,856 KB
testcase_21 AC 146 ms
85,436 KB
testcase_22 AC 177 ms
88,368 KB
testcase_23 AC 205 ms
89,080 KB
testcase_24 WA -
testcase_25 AC 202 ms
89,304 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import deque

n = int(input())
 
root = [[] for i in range(n)]
for _ in range(n-1):
    a, b = (int(x) for x in input().split())
    root[b-1].append(a-1)
    root[a-1].append(b-1) 
 
stack=deque([0])
check = [-1]*n
check[0] = 1
 
while len(stack)>0:
    v = stack.popleft()
    for i in root[v]:
        if check[i] == -1:
            check[i]=check[v]+1
            stack.append(i)


count = 0

for i in check:
    if i == -1:
        count += 1

if n == 2 or count <= 1:
    print('Bob')
else:
    print('Alice')
0