結果

問題 No.977 アリス仕掛けの摩天楼
ユーザー konchanksu
提出日時 2020-04-15 16:55:18
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 601 bytes
コンパイル時間 308 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 35,396 KB
最終ジャッジ日時 2024-10-01 18:52:41
合計ジャッジ時間 6,029 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 21 WA * 5
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
dicts = {i:[] for i in range(n)}
lists = [-1 for i in range(n)]

for i in range(n - 1):
    te, mp = map(int, input().split())
    dicts[te] += [mp]
    dicts[mp] += [te]

for i in range(n):
    if dicts[i]:
        tmp = min(dicts[i])
        if tmp < i:
            lists[i] = tmp

# [print(i) for i in lists]
        
ans = len(list(filter(lambda x: x==-1, lists)))
if ans == 1:
    print('Bob')
elif ans >= 3:
    print('Alice')
else:
    a = len(list(filter(lambda x: len(x)==2, dicts.values())))
    if a + 1 == len(dicts):
        print('Bob')
    else:
        print('Alice')
0