結果
| 問題 |
No.977 アリス仕掛けの摩天楼
|
| ユーザー |
|
| 提出日時 | 2020-02-08 08:13:12 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 622 bytes |
| コンパイル時間 | 223 ms |
| コンパイル使用メモリ | 12,672 KB |
| 実行使用メモリ | 14,976 KB |
| 最終ジャッジ日時 | 2024-09-25 08:44:28 |
| 合計ジャッジ時間 | 4,834 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 24 WA * 2 |
ソースコード
N = int(input())
import sys
sys.setrecursionlimit(10**6)
class UnionFind():
def __init__(self, n):
self.par = [i for i in range(n)]
def root(self, x):
if self.par[x] == x:
return x
else:
self.par[x] = self.root(self.par[x])
return self.par[x]
def unite(self, x, y):
x = self.root(x)
y = self.root(y)
self.par[y] = x
def same(self, x, y):
return self.root(x) == self.root(y)
uf = UnionFind(N)
for i in range(N-1):
u, v = map(int, input().split())
uf.unite(u, v)
ans = set()
for i in range(N):
ans.add(uf.root(i))
print("Alice" if len(ans) > 1 else "Bob")