結果

問題 No.977 アリス仕掛けの摩天楼
ユーザー konchanksukonchanksu
提出日時 2020-03-10 17:29:48
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
RE  
実行時間 -
コード長 573 bytes
コンパイル時間 108 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 19,644 KB
最終ジャッジ日時 2024-04-27 18:43:18
合計ジャッジ時間 7,205 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 29 ms
10,752 KB
testcase_01 AC 32 ms
10,880 KB
testcase_02 AC 32 ms
10,752 KB
testcase_03 AC 31 ms
10,752 KB
testcase_04 AC 29 ms
10,752 KB
testcase_05 RE -
testcase_06 RE -
testcase_07 AC 29 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 64 ms
11,776 KB
testcase_15 RE -
testcase_16 RE -
testcase_17 RE -
testcase_18 RE -
testcase_19 RE -
testcase_20 RE -
testcase_21 AC 574 ms
17,908 KB
testcase_22 RE -
testcase_23 RE -
testcase_24 RE -
testcase_25 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

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