Submission #745169

#TimeUsernameProblemLanguageResultExecution timeMemory
745169Desh03Traffic (IOI10_traffic)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; vector<vector<int>> g; vector<int> sz, a; int ans = INT_MAX; void dfs(int u, int p) { sz[u] = a[u]; for (int v : g[u]) if (v ^ p) dfs(v, u), sz[u] += sz[v]; } void solve(int u, int p) { int x = sz[0] - sz[u]; for (int v : g[u]) if (v ^ p) solve(v, u), x = max(x, sz[v]); ans = min(ans, x); } int LocateCentre(int n, vector<int> p, vector<int> s, vector<int> d) { g.resize(n); a = p; for (int i = 0; i < n - 1; i++) { g[s[i]].push_back(d[i]); g[d[i]].push_back(s[i]); } dfs(0, 0); solve(0, 0); return ans; }

Compilation message (stderr)

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