結果

問題 No.977 アリス仕掛けの摩天楼
ユーザー konchanksukonchanksu
提出日時 2020-04-15 16:55:18
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 601 bytes
コンパイル時間 95 ms
コンパイル使用メモリ 12,800 KB
実行使用メモリ 35,520 KB
最終ジャッジ日時 2024-04-09 18:50:23
合計ジャッジ時間 5,278 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 26 ms
10,880 KB
testcase_01 AC 26 ms
10,752 KB
testcase_02 AC 27 ms
10,752 KB
testcase_03 AC 25 ms
10,752 KB
testcase_04 AC 27 ms
10,752 KB
testcase_05 AC 26 ms
10,752 KB
testcase_06 AC 25 ms
10,880 KB
testcase_07 AC 26 ms
10,752 KB
testcase_08 AC 27 ms
10,752 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 AC 28 ms
10,752 KB
testcase_12 AC 25 ms
10,752 KB
testcase_13 AC 77 ms
12,928 KB
testcase_14 AC 72 ms
12,928 KB
testcase_15 AC 73 ms
12,928 KB
testcase_16 AC 72 ms
12,928 KB
testcase_17 AC 80 ms
12,800 KB
testcase_18 AC 174 ms
17,844 KB
testcase_19 WA -
testcase_20 AC 271 ms
22,076 KB
testcase_21 AC 408 ms
27,068 KB
testcase_22 AC 536 ms
33,340 KB
testcase_23 WA -
testcase_24 AC 550 ms
35,520 KB
testcase_25 WA -
権限があれば一括ダウンロードができます

ソースコード

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