Submission #362426

#TimeUsernameProblemLanguageResultExecution timeMemory
362426aujasvit_dattaTraffic (IOI10_traffic)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; #define int long long #define pb push_back #define mp make_pair #define pii pair<int, int> #define fr first #define sc second #define all(a) a.begin(),a.end() int LocateCentre(int n, int p[], int s[], int d[]) { vector <int> graph[n]; for(int i = 0; i < n - 1; i++) { graph[s[i]].pb(d[i]); graph[d[i]].pb(s[i]); } vector <int> forward(n), backward(n); forward[0] = p[0]; for(int i = 1; i < n; i++) { forward[i] = forward[i - 1] + p[i]; } backward[n - 1] = p[n - 1]; for(int i = n - 2; i >= 0; i--) { backward[i] = backward[i + 1] + p[i]; } int mi = backward[0] - p[0]; int curr = 0; for(int i = 1; i < n; i++) { int d = backward[i] - p[i] + forward[i - 1]; if(d < mi) { mi = d; curr = i; } } // cout << mi << " " << curr << endl; return curr; } // signed main() { // int n = 3; // int p[] = {1,3,2}; // int d[] = {1,2}; // int s[] = {0,1}; // LocateCentre(n,p, s, d); // }

Compilation message (stderr)

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