Submission #508814

#TimeUsernameProblemLanguageResultExecution timeMemory
508814tabrTraffic (IOI10_traffic)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; #ifdef tabr #include "library/debug.cpp" #else #define debug(...) #endif int LocateCentre(int n, vector<int> a, vector<int> e1, vector<int> e2) { vector<vector<int>> g(n); for (int i = 0; i < n - 1; i++) { e1[i]--; e2[i]--; g[e1[i]].emplace_back(e2[i]); g[e2[i]].emplace_back(e1[i]); } function<void(int, int)> dfs = [&](int v, int p) { for (int to : g[v]) { if (to == p) { continue; } dfs(to, v); a[v] += a[to]; } }; dfs(0, -1); int ans = -1; int sum = (int) 2e9 + 10; function<void(int, int)> reroot = [&](int v, int p) { int mx = -1; for (int to : g[v]) { mx = max(mx, a[to]); } if (mx < sum) { sum = mx; ans = v; } for (int to : g[v]) { if (to == p) { continue; } int qv = a[v]; int qto = a[to]; a[v] = qv - qto; a[to] = qv; reroot(to, v); a[v] = qv; a[to] = qto; } }; reroot(0, -1); ans++; return ans; }

Compilation message (stderr)

/usr/bin/ld: /tmp/ccx4WOuX.o: in function `main':
grader.cpp:(.text.startup+0xe1): undefined reference to `LocateCentre(int, int*, int*, int*)'
collect2: error: ld returned 1 exit status