結果

問題 No.2888 Mamehinata
ユーザー karinohitokarinohito
提出日時 2024-09-13 21:25:47
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 784 bytes
コンパイル時間 2,274 ms
コンパイル使用メモリ 209,572 KB
実行使用メモリ 16,628 KB
最終ジャッジ日時 2024-09-13 21:25:57
合計ジャッジ時間 8,019 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,812 KB
testcase_01 AC 3 ms
6,816 KB
testcase_02 AC 2 ms
6,816 KB
testcase_03 AC 2 ms
6,940 KB
testcase_04 WA -
testcase_05 AC 2 ms
6,940 KB
testcase_06 AC 2 ms
6,940 KB
testcase_07 AC 2 ms
6,944 KB
testcase_08 AC 2 ms
6,940 KB
testcase_09 AC 2 ms
6,940 KB
testcase_10 AC 2 ms
6,940 KB
testcase_11 WA -
testcase_12 AC 2 ms
6,944 KB
testcase_13 AC 22 ms
6,940 KB
testcase_14 AC 22 ms
7,168 KB
testcase_15 WA -
testcase_16 AC 103 ms
13,116 KB
testcase_17 WA -
testcase_18 AC 40 ms
6,940 KB
testcase_19 AC 117 ms
12,940 KB
testcase_20 AC 91 ms
11,392 KB
testcase_21 AC 89 ms
10,984 KB
testcase_22 WA -
testcase_23 WA -
testcase_24 AC 99 ms
14,200 KB
testcase_25 AC 78 ms
13,884 KB
testcase_26 AC 81 ms
13,764 KB
testcase_27 AC 39 ms
11,668 KB
testcase_28 AC 16 ms
6,940 KB
testcase_29 AC 38 ms
7,680 KB
testcase_30 AC 119 ms
14,232 KB
testcase_31 AC 93 ms
12,416 KB
testcase_32 AC 60 ms
9,696 KB
testcase_33 AC 89 ms
11,832 KB
testcase_34 AC 70 ms
10,368 KB
testcase_35 AC 59 ms
9,472 KB
testcase_36 AC 139 ms
15,224 KB
testcase_37 AC 143 ms
15,420 KB
testcase_38 AC 30 ms
6,944 KB
testcase_39 AC 118 ms
13,136 KB
testcase_40 AC 148 ms
15,340 KB
testcase_41 AC 18 ms
6,944 KB
testcase_42 AC 118 ms
13,444 KB
testcase_43 AC 76 ms
13,768 KB
testcase_44 AC 81 ms
15,092 KB
testcase_45 AC 95 ms
16,628 KB
testcase_46 AC 12 ms
6,940 KB
testcase_47 AC 81 ms
14,980 KB
testcase_48 AC 70 ms
10,700 KB
testcase_49 AC 10 ms
6,940 KB
testcase_50 AC 30 ms
6,944 KB
testcase_51 AC 3 ms
6,940 KB
testcase_52 AC 2 ms
6,940 KB
testcase_53 AC 6 ms
6,944 KB
testcase_54 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using ll = long long;


int main() {

    cin.tie(nullptr);
    ios::sync_with_stdio(false);

    int N,M;
    cin>>N>>M;
    vector<vector<int>> G(N);
    for(int i=0;i<M;i++){
        int u,v;
        cin>>u>>v;
        u--;v--;
        G[u].push_back(v);
        G[v].push_back(u);
    }
    vector<int> D(N,1e9);
    queue<int> Q;
    Q.push(0);
    D[0]=0;
    while(!Q.empty()){
        int p=Q.front();
        Q.pop();
        for(int v:G[p]){
            if(D[v]<=D[p]+1)continue;
            D[v]=D[p]+1;
            Q.push(v);
        }
    }
    vector<int> AN(N+1,0);
    for(int i=0;i<N;i++){
        if(D[i]<=N)AN[D[i]]++;
    }
    for(int i=1;i<=N;i++){
        if(i>=2)AN[i]+=AN[i-2];
        cout<<AN[i]<<"\n";
    }
}
0