제출 #208592

#제출 시각아이디문제언어결과실행 시간메모리
208592DodgeBallManTraffic (IOI10_traffic)C++14
컴파일 에러
0 ms0 KiB
#include<bits/stdc++.h> #include "traffic.h" using namespace std; const int N = 1e6 + 10; bool vis[N]; long long val[N], sum; vector<int> g[N]; long long dfs( int u, int p ) { for( int v : edge[u] ) if( v != p ) val[u] += dfs( v ); return val[u]; } int LocateCentre(int N, int pp[], int S[], int D[]) { for ( int i = 0 ; i < N ; i++ ) val[i] = pp[i], sum += val[i]; for ( int i = 0 ; i < N - 1 ; i++ ) g[S[i]].emplace_back( D[i] ), g[D[i]].emplace_back( S[i] ); dfs( 0, -1 ); int ret; long long mn = 1e18; for ( int i = 0 ; i < N ; i++ ) { long long mx = sum - val[i]; for( int v : g[u] ) mx = max( mx, val[v] ); if( mn > mx ) mn = mx, ret = i; } return ret; }

컴파일 시 표준 에러 (stderr) 메시지

traffic.cpp: In function 'long long int dfs(int, int)':
traffic.cpp:12:18: error: 'edge' was not declared in this scope
     for( int v : edge[u] ) if( v != p ) val[u] += dfs( v );
                  ^~~~
traffic.cpp:12:58: error: too few arguments to function 'long long int dfs(int, int)'
     for( int v : edge[u] ) if( v != p ) val[u] += dfs( v );
                                                          ^
traffic.cpp:11:11: note: declared here
 long long dfs( int u, int p ) {
           ^~~
traffic.cpp: In function 'int LocateCentre(int, int*, int*, int*)':
traffic.cpp:25:24: error: 'u' was not declared in this scope
         for( int v : g[u] ) mx = max( mx, val[v] );
                        ^