結果

問題 No.2888 Mamehinata
ユーザー timi
提出日時 2024-09-13 21:31:30
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 507 bytes
コンパイル時間 226 ms
コンパイル使用メモリ 82,176 KB
実行使用メモリ 106,972 KB
最終ジャッジ日時 2024-09-13 21:31:49
合計ジャッジ時間 15,640 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 45 WA * 7
権限があれば一括ダウンロードができます

ソースコード

diff #

N,M=map(int,input().split())
#A=list(map(int, input().split()))
D=[[] for i in range(N)]

for i in range(M):
  x,y=map(int,input().split())
  x-=1;y-=1
  D[x].append(y);D[y].append(x)
  
from collections import deque
d=deque()
V=[-1]*N 
V[0]=0
d.append(0)
E=[0]*(N+1)
E[0]+=1
while d:
  now=d.popleft()
  for nex in D[now]:
    if V[nex]==-1:
      V[nex]=V[now]+1
      d.append(nex)
      E[V[nex]]+=1

p,q=1,0 
for i in range(1,N+1):
  if i%2==1:
    q+=E[i]
    print(q)
  else:
    p+=E[i]
    print(p)
0