제출 #553956

#제출 시각아이디문제언어결과실행 시간메모리
553956a_aguiloTraffic (IOI10_traffic)C++14
컴파일 에러
0 ms0 KiB
int dfs (int padre, int nodo, vector<vector<int>>& listaAdy, int pop[], vector<vector<int>>& dp){ if(dp[nodo][padre] != -1) return dp[nodo][padre]; dp[nodo][padre] = pop[nodo]; for(int conexion: listaAdy[nodo]){ if(conexion != padre) dp[nodo][padre]+= dfs(nodo, conexion, listaAdy, dp); } return dp[nodo][padre]; } int LocateCentre(int N, int pp[], int S[], int D[]) { vector<int> listaAdy(N); for(int i= 0; i < N; ++i){ int a = S[i]; int b = D[i]; listaAdy[a].push_back(b); } vector<vector<int>> dp(N, vector<int> N(-1)); pair<int, int> ans = make_pair(1e9, 0); for(int ciudad = 0; ciudad < n; ++ciudad){ int act = -1e9; for(int conex: listaAdy[ciudad]){ act = max(act, dfs(ciudad, conex, listaAdy, pp, dp)); } ans = min(ans, make_pair(act, ciudad)); } return ans.second; }

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

traffic.cpp:1:31: error: 'vector' has not been declared
    1 | int dfs (int padre, int nodo, vector<vector<int>>& listaAdy, int pop[], vector<vector<int>>& dp){
      |                               ^~~~~~
traffic.cpp:1:37: error: expected ',' or '...' before '<' token
    1 | int dfs (int padre, int nodo, vector<vector<int>>& listaAdy, int pop[], vector<vector<int>>& dp){
      |                                     ^
traffic.cpp: In function 'int dfs(int, int, int)':
traffic.cpp:2:8: error: 'dp' was not declared in this scope
    2 |     if(dp[nodo][padre] != -1) return dp[nodo][padre];
      |        ^~
traffic.cpp:3:5: error: 'dp' was not declared in this scope
    3 |     dp[nodo][padre] = pop[nodo];
      |     ^~
traffic.cpp:3:23: error: 'pop' was not declared in this scope
    3 |     dp[nodo][padre] = pop[nodo];
      |                       ^~~
traffic.cpp:4:23: error: 'listaAdy' was not declared in this scope
    4 |     for(int conexion: listaAdy[nodo]){
      |                       ^~~~~~~~
traffic.cpp: In function 'int LocateCentre(int, int*, int*, int*)':
traffic.cpp:11:4: error: 'vector' was not declared in this scope
   11 |    vector<int> listaAdy(N);
      |    ^~~~~~
traffic.cpp:11:11: error: expected primary-expression before 'int'
   11 |    vector<int> listaAdy(N);
      |           ^~~
traffic.cpp:15:9: error: 'listaAdy' was not declared in this scope
   15 |         listaAdy[a].push_back(b);
      |         ^~~~~~~~
traffic.cpp:17:18: error: expected primary-expression before 'int'
   17 |    vector<vector<int>> dp(N, vector<int> N(-1));
      |                  ^~~
traffic.cpp:18:4: error: 'pair' was not declared in this scope
   18 |    pair<int, int> ans = make_pair(1e9, 0);
      |    ^~~~
traffic.cpp:18:9: error: expected primary-expression before 'int'
   18 |    pair<int, int> ans = make_pair(1e9, 0);
      |         ^~~
traffic.cpp:19:33: error: 'n' was not declared in this scope
   19 |    for(int ciudad = 0; ciudad < n; ++ciudad){
      |                                 ^
traffic.cpp:21:24: error: 'listaAdy' was not declared in this scope
   21 |         for(int conex: listaAdy[ciudad]){
      |                        ^~~~~~~~
traffic.cpp:22:61: error: 'dp' was not declared in this scope; did you mean 'pp'?
   22 |             act = max(act, dfs(ciudad, conex, listaAdy, pp, dp));
      |                                                             ^~
      |                                                             pp
traffic.cpp:22:19: error: 'max' was not declared in this scope
   22 |             act = max(act, dfs(ciudad, conex, listaAdy, pp, dp));
      |                   ^~~
traffic.cpp:24:9: error: 'ans' was not declared in this scope
   24 |         ans = min(ans, make_pair(act, ciudad));
      |         ^~~
traffic.cpp:24:24: error: 'make_pair' was not declared in this scope
   24 |         ans = min(ans, make_pair(act, ciudad));
      |                        ^~~~~~~~~
traffic.cpp:24:15: error: 'min' was not declared in this scope
   24 |         ans = min(ans, make_pair(act, ciudad));
      |               ^~~
traffic.cpp:26:11: error: 'ans' was not declared in this scope
   26 |    return ans.second;
      |           ^~~