Submission #553957

#TimeUsernameProblemLanguageResultExecution timeMemory
553957a_aguiloTraffic (IOI10_traffic)C++14
Compilation error
0 ms0 KiB
#include "traffic.h" #include<bits/stdc++.h> 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; }

Compilation message (stderr)

traffic.cpp:4:31: error: 'vector' has not been declared
    4 | int dfs (int padre, int nodo, vector<vector<int>>& listaAdy, int pop[], vector<vector<int>>& dp){
      |                               ^~~~~~
traffic.cpp:4:37: error: expected ',' or '...' before '<' token
    4 | 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:5:8: error: 'dp' was not declared in this scope
    5 |     if(dp[nodo][padre] != -1) return dp[nodo][padre];
      |        ^~
traffic.cpp:6:5: error: 'dp' was not declared in this scope
    6 |     dp[nodo][padre] = pop[nodo];
      |     ^~
traffic.cpp:6:23: error: 'pop' was not declared in this scope; did you mean 'pow'?
    6 |     dp[nodo][padre] = pop[nodo];
      |                       ^~~
      |                       pow
traffic.cpp:7:23: error: 'listaAdy' was not declared in this scope
    7 |     for(int conexion: listaAdy[nodo]){
      |                       ^~~~~~~~
traffic.cpp: In function 'int LocateCentre(int, int*, int*, int*)':
traffic.cpp:14:4: error: 'vector' was not declared in this scope; did you mean 'std::vector'?
   14 |    vector<int> listaAdy(N);
      |    ^~~~~~
      |    std::vector
In file included from /usr/include/c++/10/vector:67,
                 from /usr/include/c++/10/queue:61,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:86,
                 from traffic.cpp:2:
/usr/include/c++/10/bits/stl_vector.h:389:11: note: 'std::vector' declared here
  389 |     class vector : protected _Vector_base<_Tp, _Alloc>
      |           ^~~~~~
traffic.cpp:14:11: error: expected primary-expression before 'int'
   14 |    vector<int> listaAdy(N);
      |           ^~~
traffic.cpp:18:9: error: 'listaAdy' was not declared in this scope
   18 |         listaAdy[a].push_back(b);
      |         ^~~~~~~~
traffic.cpp:20:18: error: expected primary-expression before 'int'
   20 |    vector<vector<int>> dp(N, vector<int> N(-1));
      |                  ^~~
traffic.cpp:21:4: error: 'pair' was not declared in this scope; did you mean 'std::pair'?
   21 |    pair<int, int> ans = make_pair(1e9, 0);
      |    ^~~~
      |    std::pair
In file included from /usr/include/c++/10/bits/stl_algobase.h:64,
                 from /usr/include/c++/10/bits/char_traits.h:39,
                 from /usr/include/c++/10/ios:40,
                 from /usr/include/c++/10/istream:38,
                 from /usr/include/c++/10/sstream:38,
                 from /usr/include/c++/10/complex:45,
                 from /usr/include/c++/10/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:54,
                 from traffic.cpp:2:
/usr/include/c++/10/bits/stl_pair.h:211:12: note: 'std::pair' declared here
  211 |     struct pair
      |            ^~~~
traffic.cpp:21:9: error: expected primary-expression before 'int'
   21 |    pair<int, int> ans = make_pair(1e9, 0);
      |         ^~~
traffic.cpp:22:33: error: 'n' was not declared in this scope
   22 |    for(int ciudad = 0; ciudad < n; ++ciudad){
      |                                 ^
traffic.cpp:24:24: error: 'listaAdy' was not declared in this scope
   24 |         for(int conex: listaAdy[ciudad]){
      |                        ^~~~~~~~
traffic.cpp:25:61: error: 'dp' was not declared in this scope; did you mean 'pp'?
   25 |             act = max(act, dfs(ciudad, conex, listaAdy, pp, dp));
      |                                                             ^~
      |                                                             pp
traffic.cpp:25:19: error: 'max' was not declared in this scope; did you mean 'std::max'?
   25 |             act = max(act, dfs(ciudad, conex, listaAdy, pp, dp));
      |                   ^~~
      |                   std::max
In file included from /usr/include/c++/10/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from traffic.cpp:2:
/usr/include/c++/10/bits/stl_algo.h:3486:5: note: 'std::max' declared here
 3486 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
traffic.cpp:27:9: error: 'ans' was not declared in this scope; did you mean 'abs'?
   27 |         ans = min(ans, make_pair(act, ciudad));
      |         ^~~
      |         abs
traffic.cpp:27:24: error: 'make_pair' was not declared in this scope; did you mean 'std::make_pair'?
   27 |         ans = min(ans, make_pair(act, ciudad));
      |                        ^~~~~~~~~
      |                        std::make_pair
In file included from /usr/include/c++/10/bits/stl_algobase.h:64,
                 from /usr/include/c++/10/bits/char_traits.h:39,
                 from /usr/include/c++/10/ios:40,
                 from /usr/include/c++/10/istream:38,
                 from /usr/include/c++/10/sstream:38,
                 from /usr/include/c++/10/complex:45,
                 from /usr/include/c++/10/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:54,
                 from traffic.cpp:2:
/usr/include/c++/10/bits/stl_pair.h:567:5: note: 'std::make_pair' declared here
  567 |     make_pair(_T1&& __x, _T2&& __y)
      |     ^~~~~~~~~
traffic.cpp:27:15: error: 'min' was not declared in this scope; did you mean 'std::min'?
   27 |         ans = min(ans, make_pair(act, ciudad));
      |               ^~~
      |               std::min
In file included from /usr/include/c++/10/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from traffic.cpp:2:
/usr/include/c++/10/bits/stl_algo.h:3474:5: note: 'std::min' declared here
 3474 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
traffic.cpp:29:11: error: 'ans' was not declared in this scope; did you mean 'abs'?
   29 |    return ans.second;
      |           ^~~
      |           abs