結果
問題 | No.2888 Mamehinata |
ユーザー |
|
提出日時 | 2024-09-13 23:06:58 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 402 bytes |
コンパイル時間 | 323 ms |
コンパイル使用メモリ | 82,176 KB |
実行使用メモリ | 154,408 KB |
最終ジャッジ日時 | 2024-09-13 23:07:19 |
合計ジャッジ時間 | 20,518 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 45 WA * 7 |
ソースコード
from collections import*from heapq import*(n,m),*e=[[*map(int,s.split())]for s in open(0)]g=[[]for _ in range(n)]for u,v in e:g[u-1]+=v-1,g[v-1]+=u-1,q=[(0,0)]INF=1<<60s=[INF]*ns[0]=0while q:c,p=heappop(q)if s[p]<c:continuefor v in g[p]:if s[v]>c+1:s[v]=c+1q+=(c+1,v),c=Counter(s)t=0d=[1,0]for i in range(n):t^=1d[(i+1)%2]+=c[i+1]print(d[t])