結果

問題 No.977 アリス仕掛けの摩天楼
ユーザー ptotqptotq
提出日時 2020-01-31 22:13:32
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 573 bytes
コンパイル時間 93 ms
コンパイル使用メモリ 11,932 KB
実行使用メモリ 27,484 KB
最終ジャッジ日時 2023-10-17 10:04:39
合計ジャッジ時間 3,645 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 25 ms
10,076 KB
testcase_01 AC 26 ms
10,076 KB
testcase_02 AC 26 ms
10,076 KB
testcase_03 AC 30 ms
10,076 KB
testcase_04 AC 28 ms
10,076 KB
testcase_05 AC 28 ms
10,076 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 29 ms
10,080 KB
testcase_09 AC 29 ms
10,080 KB
testcase_10 AC 28 ms
10,080 KB
testcase_11 AC 28 ms
10,080 KB
testcase_12 AC 28 ms
10,080 KB
testcase_13 AC 49 ms
11,748 KB
testcase_14 AC 50 ms
11,712 KB
testcase_15 AC 50 ms
11,716 KB
testcase_16 AC 50 ms
11,748 KB
testcase_17 AC 49 ms
11,744 KB
testcase_18 AC 98 ms
15,348 KB
testcase_19 AC 96 ms
15,320 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 341 ms
27,484 KB
testcase_24 AC 340 ms
27,484 KB
testcase_25 AC 363 ms
27,232 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
N = int(input())
adj = [[] for _ in range(N)]
for u, v in (map(int, l.split()) for l in sys.stdin):
    adj[u].append(v)
    adj[v].append(u)

hoge = 0
visited = [0]*N
for i in range(N):
    if visited[i]:
        continue
    visited[i] = 1
    stack = [i]
    flag = 0
    while stack:
        v = stack.pop()
        if len(adj[v]) < 2:
            flag = 1
        for dest in adj[v]:
            if visited[dest]:
                continue
            visited[dest] = 1
            stack.append(dest)

    hoge += flag

print('Alice' if hoge > 1 else 'Bob')
0