Submission #502537

#TimeUsernameProblemLanguageResultExecution timeMemory
502537Fake4FunTraffic (IOI10_traffic)C++14
Compilation error
0 ms0 KiB
// source: https://oj.uz/problem/view/IOI10_traffic #include<iostream> #include<vector> using namespace std; const int N=1e6+5; int n,p[N]; int t1[N],t2[N],dad[N]; vector<int> adj[N]; void DFS(int pre,int u){ t1[u]=p[u]; dad[u]=pre; for(auto i:adj[u]){ if(i==pre) continue; DFS(u,i); t1[u]+=t1[i]; } } int main(){ ios::sync_with_stdio(0),cin.tie(0),cout.tie(0); cin>>n; for(int i=1;i<=n;i++) cin>>p[i]; for(int i=1;i<n;i++){ int u,v; cin>>u>>v; adj[u].push_back(v); adj[v].push_back(u); } DFS(0,1); int all=t1[1]; int mi, pos=-1; for(int u=1;u<=n;u++){ int val=all-t1[u]; for(auto i:adj[u]){ if(i==dad[u]) continue; val=max(val,t1[i]); } if(pos==-1||mi>val) pos=u, mi=val; } cout<<pos; return 0; }

Compilation message (stderr)

/usr/bin/ld: /tmp/ccocsAMr.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccPWMtXr.o:traffic.cpp:(.text.startup+0x0): first defined here
/usr/bin/ld: /tmp/ccocsAMr.o: in function `main':
grader.cpp:(.text.startup+0xe1): undefined reference to `LocateCentre(int, int*, int*, int*)'
collect2: error: ld returned 1 exit status