結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 30 ms
10,116 KB
testcase_01 AC 30 ms
10,116 KB
testcase_02 AC 31 ms
10,116 KB
testcase_03 AC 30 ms
10,116 KB
testcase_04 AC 30 ms
10,116 KB
testcase_05 AC 29 ms
10,116 KB
testcase_06 AC 30 ms
10,116 KB
testcase_07 AC 29 ms
10,116 KB
testcase_08 AC 30 ms
10,116 KB
testcase_09 AC 31 ms
10,116 KB
testcase_10 WA -
testcase_11 AC 30 ms
10,116 KB
testcase_12 AC 30 ms
10,116 KB
testcase_13 AC 51 ms
10,308 KB
testcase_14 AC 50 ms
10,264 KB
testcase_15 AC 50 ms
10,268 KB
testcase_16 AC 51 ms
10,308 KB
testcase_17 AC 51 ms
10,352 KB
testcase_18 AC 92 ms
10,440 KB
testcase_19 WA -
testcase_20 AC 132 ms
11,076 KB
testcase_21 AC 200 ms
11,812 KB
testcase_22 AC 251 ms
12,236 KB
testcase_23 AC 248 ms
11,744 KB
testcase_24 AC 245 ms
11,744 KB
testcase_25 AC 247 ms
11,740 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:
  print("Bob")
else:
  print("Alice")
0