結果

問題 No.977 アリス仕掛けの摩天楼
ユーザー universatouniversato
提出日時 2020-01-31 22:42:42
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 431 bytes
コンパイル時間 95 ms
コンパイル使用メモリ 11,876 KB
実行使用メモリ 26,636 KB
最終ジャッジ日時 2023-10-17 11:15:51
合計ジャッジ時間 3,984 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 27 ms
10,152 KB
testcase_01 AC 27 ms
10,152 KB
testcase_02 AC 27 ms
10,152 KB
testcase_03 AC 27 ms
10,152 KB
testcase_04 AC 28 ms
10,152 KB
testcase_05 AC 26 ms
10,152 KB
testcase_06 AC 27 ms
10,152 KB
testcase_07 AC 27 ms
10,160 KB
testcase_08 AC 27 ms
10,160 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 AC 27 ms
10,160 KB
testcase_12 AC 27 ms
10,160 KB
testcase_13 AC 59 ms
11,612 KB
testcase_14 AC 58 ms
11,612 KB
testcase_15 AC 58 ms
11,612 KB
testcase_16 AC 57 ms
11,612 KB
testcase_17 AC 59 ms
11,612 KB
testcase_18 AC 121 ms
15,104 KB
testcase_19 WA -
testcase_20 AC 196 ms
17,964 KB
testcase_21 AC 297 ms
22,496 KB
testcase_22 AC 380 ms
25,772 KB
testcase_23 WA -
testcase_24 AC 364 ms
26,636 KB
testcase_25 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())

g = [[] for _ in range(n)]

for i in range(n-1):
    u, v = map(int, input().split())
    g[u].append(v)
    g[v].append(u)


zero = one = 0
for i in range(n):
    
    l = len(g[i])
    if l > 2:
        print("Alice")
        exit(0)
    
    if l == 1:
        one += 1
    if l == 0:
        # print(i)
        zero += 1

# print(g,zero,one)
if one == 2 or zero == 0:
    print("Bob")
else:
    print("Alice")
0