Submission #233885

#TimeUsernameProblemLanguageResultExecution timeMemory
233885anubhavdharTraffic (IOI10_traffic)C++14
Compilation error
0 ms0 KiB
#include<bits/stdc++.h> #include "traffic.h" #define ll long long int #define pb push_back #define mp make_pair #define FOR(i,n) for(i=0;i<(n);++i) #define FORe(i,n) for(i=1;i<=(n);++i) #define FORr(i,a,b) for(i=(a);i<(b);++i) #define FORrev(i,n) for(i=(n);i>=0;--i) #define F0R(i,n) for(int i=0;i<(n);++i) #define F0Re(i,n) for(int i=1;i<=(n);++i) #define F0Rr(i,a,b) for(ll i=(a);i<(b);++i) #define F0Rrev(i,n) for(int i=(n);i>=0;--i) #define ii pair<ll,ll> #define vi vector<ll> #define vii vector<ii> #define ff first #define ss second #define cd complex<double> #define vcd vector<cd> #define ldd long double #define dbgLine cout<<"Line : "<<__LINE__<<'\n' #define all(x) (x).begin(),(x).end() using namespace std; /* const short int __PRECISION = 10; const ll MOD = 1e9+7; const ll INF = 1e17 + 1101; const ll LOGN = 17; const ll MAXN = 1e6+5; const ll ROOTN = 320; const ldd PI = acos(-1); const ldd EPS = 1e-7;*/ vector<ll> g[MAXN]; ll People[MAXN], dp[MAXN], sum[MAXN], sm; ll dfs(ll a, ll par) { dp[a] = 0; sum[a] = People[a]; for(ll b : g[a]) if(b != par) dp[a] = max(dp[a], dfs(b, a)), sum[a] += sum[b]; return dp[a] + People[a]; } int LocateCenter(int N, int P[], int S[], int D[]) { sm = 0; F0R(i, N) g[i].clear(), People[i] = P[i], sm += P[i]; F0R(i, N-1) { g[S[i]].pb(D[i]); g[D[i]].pb(S[i]); } dfs(1, -1); ii mx = mp(INF, -1); F0R(i, N) mx = min(mx, mp(max(dp[i],sm - sum[i]),(ll) i)); //cerr<<mx.ff<<' '<<mx.ss<<'\n'; return mx.ss; } /* int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); int N; cin>>N; int P[N], S[N], D[N]; F0R(i, N) cin>>P[i]; F0R(i, N-1) cin>>S[i]>>D[i]; cout<<LocateCenter(N, P, S, D); return 0; }*/

Compilation message (stderr)

traffic.cpp:39:14: error: 'MAXN' was not declared in this scope
 vector<ll> g[MAXN];
              ^~~~
traffic.cpp:39:14: note: suggested alternative: 'NAN'
 vector<ll> g[MAXN];
              ^~~~
              NAN
traffic.cpp:40:11: error: 'MAXN' was not declared in this scope
 ll People[MAXN], dp[MAXN], sum[MAXN], sm;
           ^~~~
traffic.cpp:40:11: note: suggested alternative: 'NAN'
 ll People[MAXN], dp[MAXN], sum[MAXN], sm;
           ^~~~
           NAN
traffic.cpp:40:21: error: 'MAXN' was not declared in this scope
 ll People[MAXN], dp[MAXN], sum[MAXN], sm;
                     ^~~~
traffic.cpp:40:21: note: suggested alternative: 'NAN'
 ll People[MAXN], dp[MAXN], sum[MAXN], sm;
                     ^~~~
                     NAN
traffic.cpp:40:32: error: 'MAXN' was not declared in this scope
 ll People[MAXN], dp[MAXN], sum[MAXN], sm;
                                ^~~~
traffic.cpp:40:32: note: suggested alternative: 'NAN'
 ll People[MAXN], dp[MAXN], sum[MAXN], sm;
                                ^~~~
                                NAN
traffic.cpp: In function 'long long int dfs(long long int, long long int)':
traffic.cpp:44:2: error: 'dp' was not declared in this scope
  dp[a] = 0;
  ^~
traffic.cpp:44:2: note: suggested alternative: 'mp'
  dp[a] = 0;
  ^~
  mp
traffic.cpp:45:2: error: 'sum' was not declared in this scope
  sum[a] = People[a];
  ^~~
traffic.cpp:45:2: note: suggested alternative: 'sm'
  sum[a] = People[a];
  ^~~
  sm
traffic.cpp:45:11: error: 'People' was not declared in this scope
  sum[a] = People[a];
           ^~~~~~
traffic.cpp:45:11: note: suggested alternative: 'expl'
  sum[a] = People[a];
           ^~~~~~
           expl
traffic.cpp:46:13: error: 'g' was not declared in this scope
  for(ll b : g[a])
             ^
traffic.cpp: In function 'int LocateCenter(int, int*, int*, int*)':
traffic.cpp:58:3: error: 'g' was not declared in this scope
   g[i].clear(), People[i] = P[i], sm += P[i];
   ^
traffic.cpp:58:17: error: 'People' was not declared in this scope
   g[i].clear(), People[i] = P[i], sm += P[i];
                 ^~~~~~
traffic.cpp:58:17: note: suggested alternative: 'expl'
   g[i].clear(), People[i] = P[i], sm += P[i];
                 ^~~~~~
                 expl
traffic.cpp:61:3: error: 'g' was not declared in this scope
   g[S[i]].pb(D[i]);
   ^
traffic.cpp:65:13: error: 'INF' was not declared in this scope
  ii mx = mp(INF, -1);
             ^~~
traffic.cpp:65:13: note: suggested alternative: 'SING'
  ii mx = mp(INF, -1);
             ^~~
             SING
traffic.cpp:67:23: error: 'dp' was not declared in this scope
   mx = min(mx, mp(max(dp[i],sm - sum[i]),(ll) i));
                       ^~
traffic.cpp:67:23: note: suggested alternative: 'mp'
   mx = min(mx, mp(max(dp[i],sm - sum[i]),(ll) i));
                       ^~
                       mp
traffic.cpp:67:34: error: 'sum' was not declared in this scope
   mx = min(mx, mp(max(dp[i],sm - sum[i]),(ll) i));
                                  ^~~
traffic.cpp:67:34: note: suggested alternative: 'sm'
   mx = min(mx, mp(max(dp[i],sm - sum[i]),(ll) i));
                                  ^~~
                                  sm