結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 35 ms
53,632 KB
testcase_01 AC 35 ms
53,888 KB
testcase_02 AC 35 ms
53,632 KB
testcase_03 AC 34 ms
53,760 KB
testcase_04 AC 35 ms
53,888 KB
testcase_05 AC 35 ms
53,888 KB
testcase_06 AC 35 ms
53,632 KB
testcase_07 AC 36 ms
53,888 KB
testcase_08 AC 41 ms
54,528 KB
testcase_09 AC 36 ms
54,272 KB
testcase_10 WA -
testcase_11 AC 36 ms
54,144 KB
testcase_12 AC 38 ms
54,656 KB
testcase_13 AC 87 ms
77,680 KB
testcase_14 AC 85 ms
77,728 KB
testcase_15 AC 84 ms
77,636 KB
testcase_16 AC 84 ms
77,696 KB
testcase_17 AC 88 ms
78,156 KB
testcase_18 AC 107 ms
80,204 KB
testcase_19 WA -
testcase_20 AC 124 ms
82,652 KB
testcase_21 AC 152 ms
85,504 KB
testcase_22 AC 183 ms
87,916 KB
testcase_23 AC 206 ms
88,832 KB
testcase_24 AC 199 ms
89,156 KB
testcase_25 AC 211 ms
89,216 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] = 0
 
while len(stack)>0:
    v = stack.popleft()
    for i in root[v]:
        if check[i] == -1:
            check[i]=v+1
            stack.append(i)

if -1 in check and 2 < n:
    print('Alice')
else:
    print('Bob')
0