Submission #373484

#TimeUsernameProblemLanguageResultExecution timeMemory
373484eulerdesojaTraffic (IOI10_traffic)C++14
Compilation error
0 ms0 KiB
#include<bits/stdc++.h> #include<fstream> using namespace std; #define int long long #define pb push_back #define sz(x) int(x.size()) typedef pair<int,int>ii; typedef vector<int> vi; const int mxn=1e6+6; vi g[mxn]; int n,a[mxn],ma[mxn],sum[mxn];//maximum of congestion in a road void dfs(int i,int p){ for(int j:g[i])if(j!=p){ dfs(j,i); sum[i]+=sum[j]; ma[i]=max(ma[i],max(ma[j],sum[j])); } sum[i]+=a[i]; } int32_t main(){ ios_base::sync_with_stdio(0);cin.tie(0); cin>>n; for(int i=0;i<n;i++)cin>>a[i]; for(int i=0;i<n-1;i++){ int x,y;cin>>x>>y; g[x].pb(y); g[y].pb(x); } int ans=1e18,res; for(int i=0;i<n;i++){ memset(sum,0,sizeof(sum)); memset(ma,0,sizeof(ma)); dfs(i,-1); if(ma[i]<ans){ ans=ma[i]; res=i; } } cout<<res<<"\n"; return 0; } /* 5 10 10 10 20 20 0 2 1 2 2 3 3 4 */

Compilation message (stderr)

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