結果

問題 No.977 アリス仕掛けの摩天楼
ユーザー takakintakakin
提出日時 2020-05-15 14:08:35
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 564 bytes
コンパイル時間 464 ms
コンパイル使用メモリ 11,844 KB
実行使用メモリ 12,156 KB
最終ジャッジ日時 2023-10-19 03:11:25
合計ジャッジ時間 3,406 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 29 ms
10,036 KB
testcase_01 AC 32 ms
10,036 KB
testcase_02 AC 30 ms
10,036 KB
testcase_03 AC 31 ms
10,036 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 32 ms
10,036 KB
testcase_07 AC 32 ms
10,036 KB
testcase_08 AC 31 ms
10,036 KB
testcase_09 AC 31 ms
10,036 KB
testcase_10 AC 31 ms
10,036 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 52 ms
10,228 KB
testcase_14 AC 50 ms
10,184 KB
testcase_15 AC 51 ms
10,188 KB
testcase_16 AC 51 ms
10,228 KB
testcase_17 WA -
testcase_18 AC 93 ms
10,360 KB
testcase_19 AC 95 ms
10,588 KB
testcase_20 AC 138 ms
10,996 KB
testcase_21 AC 201 ms
11,732 KB
testcase_22 AC 254 ms
12,156 KB
testcase_23 AC 245 ms
11,664 KB
testcase_24 WA -
testcase_25 AC 247 ms
11,660 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input=lambda: sys.stdin.readline().rstrip()
n=int(input())
par=[-1]*n

def find(x):
  if par[x]<0:
    return x
  else:
    par[x]=find(par[x])
    return par[x]

def unite(x,y):
  x=find(x)
  y=find(y)
  if x==y:
    return False
  else:
    if par[x]>par[y]:
      x,y=y,x
    par[x]+=par[y]
    par[y]=x
    return True

def same(x,y):
  return find(x)==find(y)

def size(x):
  return -par[find(x)]

for _ in range(n-1):
  u,v=map(int,input().split())
  unite(u,v)
for i in range(n):
  find(i)
if -min(par)>=n-1:
  print("Bob")
else:
  print("Alice")
0