結果

問題 No.977 アリス仕掛けの摩天楼
ユーザー NagisaNagisa
提出日時 2020-02-07 17:19:46
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 640 bytes
コンパイル時間 159 ms
コンパイル使用メモリ 11,860 KB
実行使用メモリ 28,316 KB
最終ジャッジ日時 2023-10-25 23:06:36
合計ジャッジ時間 3,359 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 29 ms
10,048 KB
testcase_01 AC 30 ms
10,048 KB
testcase_02 AC 29 ms
10,048 KB
testcase_03 AC 29 ms
10,048 KB
testcase_04 AC 27 ms
10,048 KB
testcase_05 AC 28 ms
10,048 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 28 ms
10,052 KB
testcase_09 AC 28 ms
10,052 KB
testcase_10 AC 29 ms
10,052 KB
testcase_11 AC 29 ms
10,052 KB
testcase_12 AC 30 ms
10,052 KB
testcase_13 AC 47 ms
11,852 KB
testcase_14 AC 44 ms
11,616 KB
testcase_15 AC 47 ms
12,288 KB
testcase_16 AC 50 ms
11,852 KB
testcase_17 AC 49 ms
13,700 KB
testcase_18 AC 94 ms
15,600 KB
testcase_19 AC 105 ms
21,176 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 329 ms
28,316 KB
testcase_24 AC 285 ms
28,300 KB
testcase_25 AC 325 ms
28,296 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys, math
sys.setrecursionlimit(10**5 + 10)

def input():
    return sys.stdin.readline()[:-1]

def main():
    N = int(input())
    G = [[] for k in range(N)]
    F = [0 for k in range(N)]
    for k in range(N-1):
        u, v = map(int,input().split())
        G[u].append(v)
        G[v].append(u)
        F[u] += 1
        F[v] += 1
    V = [0 for k in range(N)]
    def dfs(ima):
        for e in G[ima]:
            if V[e] == 0:
                V[e] = 1
                dfs(e)
    dfs(0)
    if V.count(1) == N or F.count(2) == N-1:
        print("Bob")
    else:
        print("Alice")

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