結果
問題 | No.2888 Mamehinata |
ユーザー | GOTKAKO |
提出日時 | 2024-09-13 22:42:21 |
言語 | C++17 (gcc 12.3.0 + boost 1.83.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,023 bytes |
コンパイル時間 | 2,336 ms |
コンパイル使用メモリ | 208,864 KB |
実行使用メモリ | 15,988 KB |
最終ジャッジ日時 | 2024-09-13 22:42:47 |
合計ジャッジ時間 | 8,055 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge6 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
6,816 KB |
testcase_01 | AC | 2 ms
6,944 KB |
testcase_02 | AC | 2 ms
6,944 KB |
testcase_03 | AC | 2 ms
6,944 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,940 KB |
testcase_08 | AC | 2 ms
6,940 KB |
testcase_09 | AC | 2 ms
6,944 KB |
testcase_10 | AC | 2 ms
6,940 KB |
testcase_11 | WA | - |
testcase_12 | AC | 2 ms
6,944 KB |
testcase_13 | AC | 21 ms
6,940 KB |
testcase_14 | AC | 21 ms
7,168 KB |
testcase_15 | WA | - |
testcase_16 | AC | 94 ms
13,188 KB |
testcase_17 | WA | - |
testcase_18 | AC | 41 ms
6,940 KB |
testcase_19 | AC | 100 ms
13,000 KB |
testcase_20 | AC | 87 ms
11,392 KB |
testcase_21 | AC | 88 ms
11,136 KB |
testcase_22 | WA | - |
testcase_23 | WA | - |
testcase_24 | AC | 96 ms
14,220 KB |
testcase_25 | AC | 77 ms
13,952 KB |
testcase_26 | AC | 79 ms
13,624 KB |
testcase_27 | AC | 39 ms
11,628 KB |
testcase_28 | AC | 15 ms
6,944 KB |
testcase_29 | AC | 38 ms
7,680 KB |
testcase_30 | AC | 123 ms
14,260 KB |
testcase_31 | AC | 87 ms
12,464 KB |
testcase_32 | AC | 55 ms
9,600 KB |
testcase_33 | AC | 82 ms
11,648 KB |
testcase_34 | AC | 67 ms
10,368 KB |
testcase_35 | AC | 58 ms
9,344 KB |
testcase_36 | AC | 127 ms
15,076 KB |
testcase_37 | AC | 131 ms
15,496 KB |
testcase_38 | AC | 29 ms
6,944 KB |
testcase_39 | AC | 117 ms
13,184 KB |
testcase_40 | AC | 126 ms
15,336 KB |
testcase_41 | AC | 19 ms
6,940 KB |
testcase_42 | AC | 106 ms
13,612 KB |
testcase_43 | AC | 76 ms
13,260 KB |
testcase_44 | AC | 80 ms
14,576 KB |
testcase_45 | AC | 97 ms
15,988 KB |
testcase_46 | AC | 12 ms
6,944 KB |
testcase_47 | AC | 82 ms
14,220 KB |
testcase_48 | AC | 73 ms
10,336 KB |
testcase_49 | AC | 10 ms
6,944 KB |
testcase_50 | AC | 30 ms
6,940 KB |
testcase_51 | AC | 3 ms
6,940 KB |
testcase_52 | AC | 3 ms
6,940 KB |
testcase_53 | AC | 6 ms
6,944 KB |
testcase_54 | WA | - |
ソースコード
#include <bits/stdc++.h> using namespace std; vector<int> BFS(vector<vector<int>> &Graph,int start){ int N = Graph.size(); vector<int> ret(N,-1); queue<int> Q; ret.at(start) = 0,Q.push(start); while(Q.size()){ int pos = Q.front(); Q.pop(); for(auto to : Graph.at(pos)){ if(ret.at(to) != -1) continue; ret.at(to) = ret.at(pos)+1; Q.push(to); } } return ret; } int main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); int N,M; cin >> N >> M; vector<vector<int>> Graph(N); for(int i=0; i<M; i++){ int u,v; cin >> u >> v; u--; v--; Graph.at(u).push_back(v); Graph.at(v).push_back(u); } vector<int> dist = BFS(Graph,0); vector<int> rev(N+1); for(auto &d : dist) if(d != -1) rev.at(d)++; int one = 1,two = 0; for(int i=1; i<=N; i++){ if(i%2 == 0) one += rev.at(i),cout << one << "\n"; else two += rev.at(i),cout << two << "\n"; } }