Submission #835012

#TimeUsernameProblemLanguageResultExecution timeMemory
835012Desh03Stations (IOI20_stations)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; vector<vector<int>> g, up; vector<int> in, en, dep; int t, lg; void dfs(int u) { in[u] = t++; for (int i = 1; i < lg; i++) { up[i][u] = up[i - 1][up[i - 1][u]]; } for (int v : g[u]) { if (up[0][u] ^ v) { up[0][v] = u; dep[v] = dep[u] + 1; dfs(v); } } en[u] = t; } bool upper(int u, int v) { return in[u] <= in[v] && en[v] <= en[u]; } vector<int> label(int n, int k, const vector<int> &u, const vector<int> &v) { lg = t = 0, g = vector<vector<int>> (n), in = en = dep = vector<int> (n); while ((1 << lg) <= n) ++lg; up = vector<vector<int>> (n, vector<int> (lg)); for (int i = 0; i < n - 1; i++) { g[u[i]].push_back(v[i]); g[v[i]].push_back(u[i]); } dfs(0); vector<int> ret(n); iota(ret.begin(), ret.end(), 0); return ret; } int kth(int u, int k) { for (int i = 0; i < lg; i++) { if (k >> i & 1) { u = up[i][u]; } } return u; } int find_next_station(int s, int t, const vector<int> &c) { if (!upper(t, s)) return up[0][s]; return kth(t, dep[t] - dep[s] - 1); }

Compilation message (stderr)

/usr/bin/ld: /tmp/ccMT1XSQ.o: in function `main':
stub.cpp:(.text.startup+0x2b5): undefined reference to `label(int, int, std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >)'
/usr/bin/ld: stub.cpp:(.text.startup+0x4cc): undefined reference to `find_next_station(int, int, std::vector<int, std::allocator<int> >)'
collect2: error: ld returned 1 exit status