Submission #491574

#TimeUsernameProblemLanguageResultExecution timeMemory
491574vendx_greybackTraffic (IOI10_traffic)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; #define int long long #define all(x) (x).begin(),(x).end() typedef pair<int,int> ppi; typedef vector<int> vi; typedef vector<vector<int>> vvi; const int mxn = 1e6; vi adj[mxn]; int sz[mxn]; int mx[mxn]; void dfs(int u, int p){ for(auto v: adj[u]){ if(v == p) continue; dfs(v, u); sz[u] += sz[v]; mx[u] = max(mx[u], sz[v]); } } int LocateCentre(int n, int p[], int s[], int d[]){ for(int i = 0; i < n-1; i++){ adj[s[i]].push_back(d[i]); adj[d[i]].push_back(s[i]); } int total = 0; for(int i = 0; i < n; i++){ sz[i] = p[i]; total += p[i]; } dfs(0, -1); int wt = 1e18; int res = -1; for(int i = 0; i < n; i++){ int temp = max(mx[i], total - sz[i]); if(temp < wt){ wt = temp; res = i; } } return res; }

Compilation message (stderr)

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