結果
問題 |
No.977 アリス仕掛けの摩天楼
|
ユーザー |
|
提出日時 | 2023-03-28 12:43:16 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 469 bytes |
コンパイル時間 | 204 ms |
コンパイル使用メモリ | 82,128 KB |
実行使用メモリ | 88,680 KB |
最終ジャッジ日時 | 2024-09-20 03:14:05 |
合計ジャッジ時間 | 3,936 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 24 WA * 2 |
ソースコード
n= int(input()) graph = [[] for i in range(n+1)] for i in range(n-1): a,b = map(int,input().split()) graph[a].append(b) graph[b].append(a) from collections import deque que = deque([0]) depth = [-1]*(n+1) depth[0] = 0 while que: crr = que.popleft() for nxt in graph[crr]: if depth[nxt] == -1: depth[nxt] = depth[crr]+1 que.append(nxt) flg = 1 for i in range(n): flg &= (depth[i] != -1) if flg: print("Bob") else: print("Alice")