結果
問題 | No.2888 Mamehinata |
ユーザー | InTheBloom |
提出日時 | 2024-09-13 21:43:32 |
言語 | C++23(gcc13) (gcc 13.2.0 + boost 1.83.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,473 bytes |
コンパイル時間 | 2,077 ms |
コンパイル使用メモリ | 98,296 KB |
実行使用メモリ | 19,036 KB |
最終ジャッジ日時 | 2024-09-13 21:43:51 |
合計ジャッジ時間 | 9,455 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
5,248 KB |
testcase_01 | AC | 2 ms
5,376 KB |
testcase_02 | AC | 2 ms
5,376 KB |
testcase_03 | AC | 2 ms
5,376 KB |
testcase_04 | WA | - |
testcase_05 | AC | 2 ms
5,376 KB |
testcase_06 | AC | 2 ms
5,376 KB |
testcase_07 | AC | 2 ms
5,376 KB |
testcase_08 | AC | 2 ms
5,376 KB |
testcase_09 | AC | 2 ms
5,376 KB |
testcase_10 | AC | 2 ms
5,376 KB |
testcase_11 | WA | - |
testcase_12 | AC | 2 ms
5,376 KB |
testcase_13 | AC | 51 ms
5,376 KB |
testcase_14 | AC | 35 ms
8,320 KB |
testcase_15 | WA | - |
testcase_16 | AC | 174 ms
15,232 KB |
testcase_17 | WA | - |
testcase_18 | AC | 95 ms
6,144 KB |
testcase_19 | AC | 196 ms
14,824 KB |
testcase_20 | AC | 160 ms
13,048 KB |
testcase_21 | AC | 159 ms
12,544 KB |
testcase_22 | WA | - |
testcase_23 | WA | - |
testcase_24 | AC | 169 ms
16,584 KB |
testcase_25 | AC | 141 ms
16,344 KB |
testcase_26 | AC | 137 ms
16,000 KB |
testcase_27 | AC | 66 ms
14,036 KB |
testcase_28 | AC | 27 ms
5,376 KB |
testcase_29 | AC | 72 ms
8,704 KB |
testcase_30 | AC | 207 ms
16,424 KB |
testcase_31 | AC | 172 ms
14,120 KB |
testcase_32 | AC | 110 ms
11,008 KB |
testcase_33 | AC | 150 ms
13,328 KB |
testcase_34 | AC | 120 ms
11,776 KB |
testcase_35 | AC | 106 ms
10,752 KB |
testcase_36 | AC | 227 ms
17,408 KB |
testcase_37 | AC | 249 ms
17,792 KB |
testcase_38 | AC | 62 ms
7,424 KB |
testcase_39 | AC | 204 ms
15,104 KB |
testcase_40 | AC | 242 ms
17,536 KB |
testcase_41 | AC | 34 ms
6,144 KB |
testcase_42 | AC | 204 ms
15,488 KB |
testcase_43 | AC | 145 ms
15,792 KB |
testcase_44 | AC | 166 ms
17,364 KB |
testcase_45 | AC | 184 ms
19,036 KB |
testcase_46 | AC | 23 ms
5,376 KB |
testcase_47 | AC | 162 ms
16,880 KB |
testcase_48 | AC | 166 ms
11,844 KB |
testcase_49 | AC | 23 ms
5,376 KB |
testcase_50 | AC | 76 ms
5,888 KB |
testcase_51 | AC | 5 ms
5,376 KB |
testcase_52 | AC | 3 ms
5,376 KB |
testcase_53 | AC | 12 ms
5,376 KB |
testcase_54 | WA | - |
ソースコード
#include <iostream> #include <vector> #include <queue> using namespace std; using ll = long long; int main () { // i回目のイベントで深さiまでの頂点が影響を受ける。 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[u].push_back(v); graph[v].push_back(u); } vector<int> dist(N, -1); dist[0] = 0; queue<int> q; q.push(0); while (!q.empty()) { auto pos = q.front(); q.pop(); for (auto nex: graph[pos]) { if (dist[nex] == -1) { dist[nex] = dist[pos] + 1; q.push(nex); } } } vector<int> count(N + 1); for (int i = 0; i < N; i++) if (0 <= dist[i]) count[dist[i]]++; vector<int> acc_even(N + 1), acc_odd(N + 1); for (int i = 0; i <= N; i++) { if (0 <= i - 1) { acc_even[i] = acc_even[i - 1]; acc_odd[i] = acc_odd[i - 1]; } if (i % 2 == 0) { acc_even[i] += count[i]; } if (i % 2 == 1) { acc_odd[i] += count[i]; } } vector<int> ans(N + 1); for (int i = 1; i <= N; i++) { if (i % 2 == 0) { ans[i] = acc_even[i]; } if (i % 2 == 1) { ans[i] = acc_odd[i]; } } for (int i = 1; i <= N; i++) cout << ans[i] << "\n"; return 0; }