結果

問題 No.977 アリス仕掛けの摩天楼
ユーザー 💕💖💞💕💖💞
提出日時 2020-04-01 13:56:51
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 440 bytes
コンパイル時間 95 ms
コンパイル使用メモリ 10,952 KB
実行使用メモリ 32,476 KB
最終ジャッジ日時 2023-09-08 18:02:32
合計ジャッジ時間 5,353 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,828 KB
testcase_01 AC 15 ms
7,720 KB
testcase_02 AC 15 ms
7,848 KB
testcase_03 AC 16 ms
7,796 KB
testcase_04 AC 16 ms
7,820 KB
testcase_05 AC 15 ms
7,768 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 16 ms
7,796 KB
testcase_09 AC 16 ms
7,724 KB
testcase_10 AC 16 ms
7,864 KB
testcase_11 AC 15 ms
7,724 KB
testcase_12 AC 16 ms
7,848 KB
testcase_13 WA -
testcase_14 AC 51 ms
10,388 KB
testcase_15 AC 51 ms
10,380 KB
testcase_16 WA -
testcase_17 AC 52 ms
10,384 KB
testcase_18 WA -
testcase_19 AC 135 ms
15,056 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 462 ms
32,476 KB
testcase_24 AC 426 ms
32,360 KB
testcase_25 AC 456 ms
32,296 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())

i_cs = {}
for i in range(n):
    i_cs[i] = []
for i in range(n-1):
    s, d = map(int, input().split())
    i_cs[s].append(d)
    i_cs[d].append(s)
# print(i_cs)

free_num = sum([1 for i, cs in i_cs.items() if len(cs) ==0])
# print(free_num)

one_num = sum([1 for i, cs in i_cs.items() if len(cs) == 1])

if free_num >= 2:
    print("Alice")
elif free_num == 1 and one_num >= 1:
    print("Alice")
else:
    print("Bob")

0