Submission #956369

#TimeUsernameProblemLanguageResultExecution timeMemory
956369Desh03Stations (IOI20_stations)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; const int lg = 10, N = 10000; vector<int> g[N]; int up[lg][N], in[N], en[N], dep[N], t; void dfs(int u, int p) { for (int v : g[u]) { g[v].erase(find(g[v].begin(), g[v].end(), u)); in[v] = t++; up[0][in[v]] = in[u]; for (int i = 1; i < lg; i++) { up[i][in[v]] = up[i - 1][up[i - 1][in[v]]]; } dep[in[v]] = dep[in[u]] + 1; dfs(v); } en[in[u]] = t; } bool upper(int u, int v) { return u <= v && en[v] <= en[u]; } vector<int> label(int n, int k, vector<int> u, vector<int> v) { for (int i = 0; i < n; i++) g[i].clear(); for (int i = 0; i < n - 1; i++) { g[u[i]].push_back(v[i]); g[v[i]].push_back(u[i]); } in[0] = t++; dep[in[0]] = 0; dfs(0); vector<int> ret(n); for (int i = 0; i < n; i++) { ret[i] = in[i]; } 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, vector<int> c) { if (!upper(s, t)) return up[0][s]; return kth(t, dep[t] - dep[s] - 1); }

Compilation message (stderr)

stations.cpp: In function 'void dfs(int, int)':
stations.cpp:18:14: error: too few arguments to function 'void dfs(int, int)'
   18 |         dfs(v);
      |              ^
stations.cpp:9:6: note: declared here
    9 | void dfs(int u, int p) {
      |      ^~~
stations.cpp: In function 'std::vector<int> label(int, int, std::vector<int>, std::vector<int>)':
stations.cpp:35:10: error: too few arguments to function 'void dfs(int, int)'
   35 |     dfs(0);
      |          ^
stations.cpp:9:6: note: declared here
    9 | void dfs(int u, int p) {
      |      ^~~