結果

問題 No.977 アリス仕掛けの摩天楼
ユーザー zaki_chemtechzaki_chemtech
提出日時 2020-07-10 20:43:32
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 465 bytes
コンパイル時間 172 ms
コンパイル使用メモリ 82,468 KB
実行使用メモリ 89,060 KB
最終ジャッジ日時 2024-04-19 15:06:39
合計ジャッジ時間 3,310 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 36 ms
54,000 KB
testcase_01 AC 36 ms
54,312 KB
testcase_02 AC 36 ms
54,676 KB
testcase_03 AC 36 ms
54,096 KB
testcase_04 AC 37 ms
54,944 KB
testcase_05 AC 38 ms
54,428 KB
testcase_06 AC 37 ms
54,056 KB
testcase_07 AC 38 ms
55,316 KB
testcase_08 AC 38 ms
55,316 KB
testcase_09 AC 39 ms
54,920 KB
testcase_10 WA -
testcase_11 AC 38 ms
56,104 KB
testcase_12 AC 38 ms
54,624 KB
testcase_13 AC 89 ms
77,644 KB
testcase_14 AC 80 ms
77,360 KB
testcase_15 AC 91 ms
77,660 KB
testcase_16 AC 88 ms
77,408 KB
testcase_17 AC 87 ms
77,392 KB
testcase_18 AC 111 ms
80,056 KB
testcase_19 WA -
testcase_20 AC 132 ms
82,416 KB
testcase_21 AC 150 ms
85,312 KB
testcase_22 AC 185 ms
87,768 KB
testcase_23 AC 219 ms
89,024 KB
testcase_24 AC 208 ms
89,060 KB
testcase_25 AC 228 ms
89,036 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].append(a)
    root[a].append(b) 
 
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)

if n == 2 or -1 not in check:
    print('Bob')
else:
    print('Alice')
0