Submission #278787

#TimeUsernameProblemLanguageResultExecution timeMemory
278787ec1117Traffic (IOI10_traffic)C++17
Compilation error
0 ms0 KiB
#include "bits/stdc++.h" #include "grader.c" #include "traffic.h" using namespace std; #define pb push_back #define mp make_pair typedef vector<int> vi; vi adj[1000001]; long long w[1000001]; long long sum[1000001]; int pars[1000001]; void dfs(int n, int par){ pars[n]=par; sum[n]+=w[n]; for(int x:adj[n]){ if(x!=par){ dfs(x,n); } sum[n]+=sum[x]; } } int LocateCentre(int n, int p[], int s[], int d[]){//int[] s? long long tsum=0; for(int i=0;i<n;i++){ adj[s[i]].push_back(d[i]); adj[d[i]].push_back(s[i]); } for(int i=0;i<n;i++){ w[i]=p[i]; tsum+=p[i]; } dfs(0,-1); int ret=0; long long mins=LLONG_MAX; for(int i=0;i<n;i++){ long long tmp=0; for(int j:adj[i]){ if(j!=pars[i]) { tmp = max(tmp, sum[j]); } } tmp=max(tmp,tsum-sum[pars[i]]); if(tmp<mins){ mins=tmp; ret=i; } } return ret; } //int main(){ // int n; // cin >> n; // int p[n],s[n],d[n]; // for(int i=0;i<n;i++)cin >>p[i]; // for(int i=0;i<n;i++)cin >>s[i]; // for(int i=0;i<n;i++)cin >>d[i]; // cout << LocateCentre(n,p,s,d); // return 0; //}

Compilation message (stderr)

/tmp/cc6MxOQg.o: In function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'
/tmp/ccnB6xVD.o:traffic.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status