結果

問題 No.977 アリス仕掛けの摩天楼
ユーザー tamatotamato
提出日時 2020-01-31 21:32:06
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 558 bytes
コンパイル時間 614 ms
コンパイル使用メモリ 81,660 KB
実行使用メモリ 85,184 KB
最終ジャッジ日時 2023-10-17 08:48:14
合計ジャッジ時間 3,462 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
53,412 KB
testcase_01 AC 38 ms
53,412 KB
testcase_02 AC 38 ms
53,412 KB
testcase_03 AC 37 ms
53,412 KB
testcase_04 AC 38 ms
53,412 KB
testcase_05 AC 37 ms
53,412 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 38 ms
53,412 KB
testcase_09 AC 38 ms
53,412 KB
testcase_10 AC 38 ms
53,412 KB
testcase_11 AC 37 ms
53,412 KB
testcase_12 AC 38 ms
53,412 KB
testcase_13 WA -
testcase_14 AC 61 ms
70,432 KB
testcase_15 AC 62 ms
70,448 KB
testcase_16 WA -
testcase_17 AC 58 ms
68,372 KB
testcase_18 WA -
testcase_19 AC 80 ms
78,580 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 147 ms
84,584 KB
testcase_24 AC 133 ms
84,428 KB
testcase_25 AC 148 ms
84,584 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def main():
    import sys
    input = sys.stdin.readline

    N = int(input())
    adj = [[] for _ in range(N)]
    for _ in range(N-1):
        u, v = map(int, input().split())
        adj[u].append(v)
        adj[v].append(u)
    cnt_0 = 0
    cnt_1 = 0
    for i in range(N):
        if len(adj[i]) == 0:
            cnt_0 += 1
        elif len(adj[i]) == 1:
            cnt_1 += 1
    if cnt_0 >= 2:
        print('Alice')
    elif cnt_0 == 1 and cnt_1 >= 1:
        print('Alice')
    else:
        print('Bob')


if __name__ == '__main__':
    main()
0