Submission #380635

#TimeUsernameProblemLanguageResultExecution timeMemory
380635dinesh_b_sTraffic (IOI10_traffic)C++14
Compilation error
0 ms0 KiB
#include "traffic.h" #include<bits/stdc++.h> using namespace std; #define int long long int #define ld long double #define pb push_back #define mp make_pair #define F first #define S second #define all(x) (x).begin(), (x).end() #define pll pair<int,int> #define MOD 1000000007 #define M2 998244353 #define INF 2e18 #define EPS 1e-9 #define pi pair<int,int> #define minheap priority_queue<int, vector<int>, greater<int>> const ld PI = 3.14159265358979323846; const int MX = 1e6 + 5; int fans = 0; vector<int> g[MX], nodes(MX), people(MX), children(MX); void dfs(int v, int parent) { for (auto x: g[v]) { if (x == parent) continue; dfs(x, v); children[v] += children[x]; people[v] = max(people[v], children[x]); } people[v] = max(people[v], fans - children[v] - nodes[v]); children[v] += nodes[v]; } int LocateCentre(int n, int p[], int d[], int s[]) { for (int i = 0; i < n; i++) { fans += p[i]; nodes[i] = p[i]; } for (int i = 0; i < n - 1; i++) { g[s[i]].push_back(d[i]); g[d[i]].push_back(s[i]); } dfs(0, -1); int sol = INF, res = -1; for (int i = 0; i < n; i++) { if (people[i] < sol) { res = i; sol = people[i]; } } return res; }

Compilation message (stderr)

/tmp/ccJwYJS9.o: In function `main':
grader.cpp:(.text.startup+0xd9): undefined reference to `LocateCentre(int, int*, int*, int*)'
collect2: error: ld returned 1 exit status