제출 #1125124

#제출 시각아이디문제언어결과실행 시간메모리
1125124MatteoArcari열대 식물원 (Tropical Garden) (IOI11_garden)C++20
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; const int lg = 30; int main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); int n, m, p; cin >> n >> m >> p; vector<vector<pair<int, int>>> adj(n); for (int i = 0; i < n; i++) { int a, b; cin >> a >> b; int sa = adj[a].size(); int sb = adj[b].size(); if (sa < 2) adj[a].push_back({b, sb == 0}); if (sb < 2) adj[b].push_back({a, sa == 0}); } vector<vector<pair<int, int>>> up[2]; up[0].resize(lg, vector<pair<int, int>>(n)); up[1].resize(lg, vector<pair<int, int>>(n)); for (int i = 0; i < n; i++) { up[1][0][i] = adj[i][0]; up[0][0][i] = adj[i][0]; if (adj[i].size() > 1) { up[1][0][i] = adj[i][1]; } } for (int i = 1; i < lg; i++) { for (int j = 0; j < n; j++) { { auto [to, s] = up[0][i - 1][j]; up[0][i][j] = up[s][i - 1][to]; } { auto [to, s] = up[1][i - 1][j]; up[1][i][j] = up[s][i - 1][to]; } } } auto get_up_bro = [&](int j, int k) { int cur_state = 0; for (int i = lg - 1; i >= 0; i--) { if ((1 << i) <= k) { auto [to, s] = up[cur_state][i][j]; cur_state = s; j = to; k -= (1 << i); } } return j; }; int q; cin >> q; while (q--) { int k; cin >> k; int ans = 0; for (int i = 0; i < n; i++) { ans += get_up_bro(i, k) == p; } cout << ans << '\n'; } }

컴파일 시 표준 에러 (stderr) 메시지

/usr/bin/ld: /tmp/ccEc1Ma6.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccyVLtZO.o:garden.cpp:(.text.startup+0x0): first defined here
/usr/bin/ld: /tmp/ccEc1Ma6.o: in function `main':
grader.cpp:(.text.startup+0x3f): undefined reference to `count_routes(int, int, int, int (*) [2], int, int*)'
collect2: error: ld returned 1 exit status