結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
53,504 KB
testcase_01 AC 35 ms
54,016 KB
testcase_02 AC 35 ms
53,760 KB
testcase_03 AC 35 ms
53,760 KB
testcase_04 AC 34 ms
53,760 KB
testcase_05 AC 34 ms
53,632 KB
testcase_06 AC 35 ms
53,760 KB
testcase_07 AC 35 ms
53,888 KB
testcase_08 AC 35 ms
54,016 KB
testcase_09 AC 35 ms
54,400 KB
testcase_10 WA -
testcase_11 AC 36 ms
54,144 KB
testcase_12 AC 36 ms
54,144 KB
testcase_13 AC 88 ms
77,440 KB
testcase_14 AC 85 ms
77,568 KB
testcase_15 AC 85 ms
77,824 KB
testcase_16 AC 82 ms
77,640 KB
testcase_17 AC 87 ms
77,468 KB
testcase_18 AC 107 ms
80,384 KB
testcase_19 WA -
testcase_20 AC 126 ms
82,688 KB
testcase_21 AC 145 ms
85,248 KB
testcase_22 AC 179 ms
87,808 KB
testcase_23 AC 212 ms
88,736 KB
testcase_24 AC 197 ms
89,088 KB
testcase_25 AC 197 ms
88,960 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 not in check or n == 2:
    print('Bob')
else:
    print('Alice')
0