Submission #360240

#TimeUsernameProblemLanguageResultExecution timeMemory
360240sumit_kk10Traffic (IOI10_traffic)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #define fast ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL) using namespace std; const int N = 100000 + 5; const int MOD = 1e9 + 7; vector<int> graph[N]; int dis[N]; bool vis[N]; void dfs(int source, long long int p[]){ vis[source] = 1; dis[source] = p[source]; for(auto k : graph[source]){ if(!vis[k]) { dfs(k, p); dis[source] += dis[k]; } } } int LocateCentre(int n, long long int p[], int s[], int d[]){ for(int i = 0; i < n - 1; ++i){ graph[s[i]].push_back(d[i]); graph[d[i]].push_back(s[i]); } int mn = INT_MAX; for(int i = 0; i < n; ++i){ dfs(i, p); int mx = 0; for(auto k : graph[i]) mx = max(mx, dis[k]); mn = min(mn, mx); for(int j = 0; j < n; ++j) vis[j] = 0; } return mn; } int main() { fast; // freopen("cbarn.in", "r", stdin); // freopen("cbarn.out", "w", stdout); int n; cin >> n; long long int p[n]; int s[n], d[n]; for(int i = 0; i < n; ++i) cin >> p[i]; for(int i = 0; i < n - 1; ++i) cin >> s[i] >> d[i]; cout << LocateCentre(n, p, s, d); return 0; }

Compilation message (stderr)

/tmp/cc0dH0Ks.o: In function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'
/tmp/cctxEXzI.o:traffic.cpp:(.text.startup+0x0): first defined here
/tmp/cc0dH0Ks.o: In function `main':
grader.cpp:(.text.startup+0xd9): undefined reference to `LocateCentre(int, int*, int*, int*)'
collect2: error: ld returned 1 exit status