結果

問題 No.977 アリス仕掛けの摩天楼
ユーザー konchanksukonchanksu
提出日時 2020-03-10 17:32:07
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
RE  
実行時間 -
コード長 616 bytes
コンパイル時間 249 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 21,148 KB
最終ジャッジ日時 2024-04-27 18:45:13
合計ジャッジ時間 4,586 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 25 ms
17,692 KB
testcase_01 AC 24 ms
10,752 KB
testcase_02 AC 24 ms
10,752 KB
testcase_03 AC 25 ms
10,752 KB
testcase_04 AC 24 ms
10,752 KB
testcase_05 RE -
testcase_06 RE -
testcase_07 AC 26 ms
10,752 KB
testcase_08 RE -
testcase_09 RE -
testcase_10 WA -
testcase_11 RE -
testcase_12 RE -
testcase_13 RE -
testcase_14 AC 56 ms
11,776 KB
testcase_15 RE -
testcase_16 RE -
testcase_17 TLE -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
sys.setrecursionlimit(200000)

def dfs(goto, u, v, now=0):
    for i in range(n-1):
        if u[i] == now and not goto[v[i]]:
            goto[v[i]] = True
            return dfs(goto, u, v, v[i])
        elif v[i] == now and not goto[u[i]]:
            goto[u[i]] = True
            return dffs(goto, u, v, u[i])
    return goto

n = int(input())
goto = [False for i in range(n)]
goto[0] = True
u, v = [], []

for i in range(n - 1):
    te, mp = map(int, input().split())
    u.append(te), v.append(mp)

goto = dfs(goto, u, v)
print('Bob' if len(list(filter(lambda x: not x, goto))) == 0 else 'Alice')

0