結果
問題 |
No.977 アリス仕掛けの摩天楼
|
ユーザー |
|
提出日時 | 2020-03-10 17:32:07 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
RE
|
実行時間 | - |
コード長 | 616 bytes |
コンパイル時間 | 331 ms |
コンパイル使用メモリ | 12,544 KB |
実行使用メモリ | 26,272 KB |
最終ジャッジ日時 | 2024-11-15 23:29:16 |
合計ジャッジ時間 | 13,026 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 8 WA * 1 RE * 14 TLE * 3 |
ソースコード
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')