Submission #1032565

#TimeUsernameProblemLanguageResultExecution timeMemory
1032565ezzzayTraffic (IOI10_traffic)C++14
Compilation error
0 ms0 KiB
#include "traffic.h" #include<bits/stdc++.h> using namespace std; #define ff first #define ss second #define pb push_back const int N=3e5+5; vector<int>v[N]; int k=0; int w[N]; int ans=INT_MAX; int x=-1; void fun(int a,int p){ int h=0; for(auto b:v[a]){ if(b==p)continue; fun(b,a); w[a]+=w[b]; } for(auto b:v[a]){ if(b==p)continue; h=max(h,w[b]); } w[a]+=pp[a]; h=max(h,k-w[a]); if(ans>h){ ans=h; x=a; } } int LocateCentre(int N, int pp[], int S[], int D[]) { int n=N; for(int i=0;i<n;i++){ w[i]=0; } for(int i=0;i<n-1;i++){ v[S[i]].pb(D[i]); v[D[i]].pb(S[i]); } for(int i=0;i<n;i++){ k+=pp[i]; } fun(0,-1); return x; }

Compilation message (stderr)

traffic.cpp: In function 'void fun(int, int)':
traffic.cpp:24:11: error: 'pp' was not declared in this scope; did you mean 'p'?
   24 |     w[a]+=pp[a];
      |           ^~
      |           p