Submission #1225955

#TimeUsernameProblemLanguageResultExecution timeMemory
1225955paskalisapoSwapping Cities (APIO20_swap)C++20
Compilation error
0 ms0 KiB
int citiesnum , roadnum; vector<vector<pair<int,int>>> adj; int ind1, ind2, ind3; int w1, w2, w3; vector<int> wtonode; bool skip = false; void init(int N, int M, std::vector<int> U, std::vector<int> V, std::vector<int> W) { if(N <= 3) { skip = true; return; } citiesnum = N; roadnum = M; priority_queue<pair<int,int>> q; wtonode.resize(N , -1); for(int i = 0 ;i < M ;i++) { if(q.size() < 3) { q.push({W[i], V[i]}); } else if(q.top().first > W[i]) { q.pop(); q.push({W[i], V[i]}); } wtonode[V[i]] = W[i]; } ind1 = q.top().second; w1 = q.top().first; q.pop(); ind2 = q.top().second; w2 = q.top().first; q.pop(); ind3= q.top().second; w3 = q.top().first; q.pop(); } int getMinimumFuelCapacity(int X, int Y) { if(skip) { return -1; } int other = w3; int value1 = wtonode[X]; int value2 = wtonode[Y]; if(X == 0) { value1 = w3; other = w2; } if(Y == 0) { value2 = w3; other = w2; } if(X == ind3 || Y == ind3) { other = w2; if(X == 0) { value1 = w2; other = w1; } if(Y == 0) { value2 = w2; other = w1; } if(X == ind2 || Y == ind2) { other = w1; } } int answer = max(value1, max(value2, other)); return answer; }

Compilation message (stderr)

swap.cpp:2:15: error: 'pair' was not declared in this scope
    2 | vector<vector<pair<int,int>>> adj;
      |               ^~~~
swap.cpp:2:15: error: 'pair' was not declared in this scope
swap.cpp:2:15: error: 'pair' was not declared in this scope
swap.cpp:2:15: error: 'pair' was not declared in this scope
swap.cpp:2:15: error: 'pair' was not declared in this scope
swap.cpp:2:15: error: 'pair' was not declared in this scope
swap.cpp:2:15: error: 'pair' was not declared in this scope
swap.cpp:2:15: error: 'pair' was not declared in this scope
swap.cpp:2:15: error: 'pair' was not declared in this scope
swap.cpp:2:15: error: 'pair' was not declared in this scope
swap.cpp:2:15: error: 'pair' was not declared in this scope
swap.cpp:2:8: error: 'vector' was not declared in this scope
    2 | vector<vector<pair<int,int>>> adj;
      |        ^~~~~~
swap.cpp:2:15: error: 'pair' was not declared in this scope
    2 | vector<vector<pair<int,int>>> adj;
      |               ^~~~
swap.cpp:2:15: error: 'pair' was not declared in this scope
swap.cpp:2:15: error: 'pair' was not declared in this scope
swap.cpp:2:15: error: 'pair' was not declared in this scope
swap.cpp:2:15: error: 'pair' was not declared in this scope
swap.cpp:2:15: error: 'pair' was not declared in this scope
swap.cpp:2:15: error: 'pair' was not declared in this scope
swap.cpp:2:15: error: 'pair' was not declared in this scope
swap.cpp:2:15: error: 'pair' was not declared in this scope
swap.cpp:2:15: error: 'pair' was not declared in this scope
swap.cpp:2:15: error: 'pair' was not declared in this scope
swap.cpp:2:15: error: 'pair' was not declared in this scope
swap.cpp:2:8: error: 'vector' was not declared in this scope
    2 | vector<vector<pair<int,int>>> adj;
      |        ^~~~~~
swap.cpp:2:15: error: 'pair' was not declared in this scope
    2 | vector<vector<pair<int,int>>> adj;
      |               ^~~~
swap.cpp:2:15: error: 'pair' was not declared in this scope
swap.cpp:2:15: error: 'pair' was not declared in this scope
swap.cpp:2:15: error: 'pair' was not declared in this scope
swap.cpp:2:15: error: 'pair' was not declared in this scope
swap.cpp:2:15: error: 'pair' was not declared in this scope
swap.cpp:2:15: error: 'pair' was not declared in this scope
swap.cpp:2:15: error: 'pair' was not declared in this scope
swap.cpp:2:15: error: 'pair' was not declared in this scope
swap.cpp:2:15: error: 'pair' was not declared in this scope
swap.cpp:2:15: error: 'pair' was not declared in this scope
swap.cpp:2:15: error: 'pair' was not declared in this scope
swap.cpp:2:8: error: 'vector' was not declared in this scope
    2 | vector<vector<pair<int,int>>> adj;
      |        ^~~~~~
swap.cpp:2:15: error: 'pair' was not declared in this scope
    2 | vector<vector<pair<int,int>>> adj;
      |               ^~~~
swap.cpp:2:15: error: 'pair' was not declared in this scope
swap.cpp:2:15: error: 'pair' was not declared in this scope
swap.cpp:2:15: error: 'pair' was not declared in this scope
swap.cpp:2:15: error: 'pair' was not declared in this scope
swap.cpp:2:15: error: 'pair' was not declared in this scope
swap.cpp:2:15: error: 'pair' was not declared in this scope
swap.cpp:2:15: error: 'pair' was not declared in this scope
swap.cpp:2:15: error: 'pair' was not declared in this scope
swap.cpp:2:15: error: 'pair' was not declared in this scope
swap.cpp:2:15: error: 'pair' was not declared in this scope
swap.cpp:2:15: error: 'pair' was not declared in this scope
swap.cpp:2:8: error: 'vector' was not declared in this scope
    2 | vector<vector<pair<int,int>>> adj;
      |        ^~~~~~
swap.cpp:2:15: error: 'pair' was not declared in this scope
    2 | vector<vector<pair<int,int>>> adj;
      |               ^~~~
swap.cpp:2:15: error: 'pair' was not declared in this scope
swap.cpp:2:15: error: 'pair' was not declared in this scope
swap.cpp:2:15: error: 'pair' was not declared in this scope
swap.cpp:2:15: error: 'pair' was not declared in this scope
swap.cpp:2:15: error: 'pair' was not declared in this scope
swap.cpp:2:15: error: 'pair' was not declared in this scope
swap.cpp:2:15: error: 'pair' was not declared in this scope
swap.cpp:2:15: error: 'pair' was not declared in this scope
swap.cpp:2:15: error: 'pair' was not declared in this scope
swap.cpp:2:15: error: 'pair' was not declared in this scope
swap.cpp:2:15: error: 'pair' was not declared in this scope
swap.cpp:2:8: error: 'vector' was not declared in this scope
    2 | vector<vector<pair<int,int>>> adj;
      |        ^~~~~~
swap.cpp:2:15: error: 'pair' was not declared in this scope
    2 | vector<vector<pair<int,int>>> adj;
      |               ^~~~
swap.cpp:2:15: error: 'pair' was not declared in this scope
swap.cpp:2:15: error: 'pair' was not declared in this scope
swap.cpp:2:15: error: 'pair' was not declared in this scope
swap.cpp:2:15: error: 'pair' was not declared in this scope
swap.cpp:2:15: error: 'pair' was not declared in this scope
swap.cpp:2:15: error: 'pair' was not declared in this scope
swap.cpp:2:15: error: 'pair' was not declared in this scope
swap.cpp:2:15: error: 'pair' was not declared in this scope
swap.cpp:2:15: error: 'pair' was not declared in this scope
swap.cpp:2:15: error: 'pair' was not declared in this scope
swap.cpp:2:15: error: 'pair' was not declared in this scope
swap.cpp:2:8: error: 'vector' was not declared in this scope
    2 | vector<vector<pair<int,int>>> adj;
      |        ^~~~~~
swap.cpp:2:15: error: 'pair' was not declared in this scope
    2 | vector<vector<pair<int,int>>> adj;
      |               ^~~~
swap.cpp:2:15: error: 'pair' was not declared in this scope
swap.cpp:2:15: error: 'pair' was not declared in this scope
swap.cpp:2:15: error: 'pair' was not declared in this scope
swap.cpp:2:15: error: 'pair' was not declared in this scope
swap.cpp:2:15: error: 'pair' was not declared in this scope
swap.cpp:2:15: error: 'pair' was not declared in this scope
swap.cpp:2:15: error: 'pair' was not declared in this scope
swap.cpp:2:15: error: 'pair' was not declared in this scope
swap.cpp:2:15: error: 'pair' was not declared in this scope
swap.cpp:2:15: error: 'pair' was not declared in this scope
swap.cpp:2:15: error: 'pair' was not declared in this scope
swap.cpp:2:8: error: 'vector' was not declared in this scope
    2 | vector<vector<pair<int,int>>> adj;
      |        ^~~~~~
swap.cpp:2:15: error: 'pair' was not declared in this scope
    2 | vector<vector<pair<int,int>>> adj;
      |               ^~~~
swap.cpp:2:15: error: 'pair' was not declared in this scope
swap.cpp:2:15: error: 'pair' was not declared in this scope
swap.cpp:2:15: error: 'pair' was not declared in this scope
swap.cpp:2:15: error: 'pair' was not declared in this scope
swap.cpp:2:15: error: 'pair' was not declared in this scope
swap.cpp:2:15: error: 'pair' was not declared in this scope
swap.cpp:2:15: error: 'pair' was not declared in this scope
swap.cpp:2:15: error: 'pair' was not declared in this scope
swap.cpp:2:15: error: 'pair' was not declared in this scope
swap.cpp:2:15: error: 'pair' was not declared in this scope
swap.cpp:2:15: error: 'pair' was not declared in this scope
swap.cpp:2:8: error: 'vector' was not declared in this scope
    2 | vector<vector<pair<int,int>>> adj;
      |        ^~~~~~
swap.cpp:2:15: error: 'pair' was not declared in this scope
    2 | vector<vector<pair<int,int>>> adj;
      |               ^~~~
swap.cpp:2:15: error: 'pair' was not declared in this scope
swap.cpp:2:15: error: 'pair' was not declared in this scope
swap.cpp:2:15: error: 'pair' was not declared in this scope
swap.cpp:2:15: error: 'pair' was not declared in this scope
swap.cpp:2:15: error: 'pair' was not declared in this scope
swap.cpp:2:15: error: 'pair' was not declared in this scope
swap.cpp:2:15: error: 'pair' was not declared in this scope
swap.cpp:2:15: error: 'pair' was not declared in this scope
swap.cpp:2:15: error: 'pair' was not declared in this scope
swap.cpp:2:15: error: 'pair' was not declared in this scope
swap.cpp:2:15: error: 'pair' was not declared in this scope
swap.cpp:2:8: error: 'vector' was not declared in this scope
    2 | vector<vector<pair<int,int>>> adj;
      |        ^~~~~~
swap.cpp:2:15: error: 'pair' was not declared in this scope
    2 | vector<vector<pair<int,int>>> adj;
      |               ^~~~
swap.cpp:2:1: error: 'vector' does not name a type
    2 | vector<vector<pair<int,int>>> adj;
      | ^~~~~~
swap.cpp:5:1: error: 'vector' does not name a type
    5 | vector<int> wtonode;
      | ^~~~~~
swap.cpp:8:5: error: 'std::vector' has not been declared
    8 |     std::vector<int> U, std::vector<int> V, std::vector<int> W) {
      |     ^~~
swap.cpp:8:16: error: expected ',' or '...' before '<' token
    8 |     std::vector<int> U, std::vector<int> V, std::vector<int> W) {
      |                ^
swap.cpp: In function 'void init(int, int, int)':
swap.cpp:15:20: error: 'pair' was not declared in this scope
   15 |     priority_queue<pair<int,int>> q;
      |                    ^~~~
swap.cpp:15:5: error: 'priority_queue' was not declared in this scope
   15 |     priority_queue<pair<int,int>> q;
      |     ^~~~~~~~~~~~~~
swap.cpp:15:25: error: expected primary-expression before 'int'
   15 |     priority_queue<pair<int,int>> q;
      |                         ^~~
swap.cpp:16:5: error: 'wtonode' was not declared in this scope
   16 |     wtonode.resize(N , -1);
      |     ^~~~~~~
swap.cpp:18:12: error: 'q' was not declared in this scope
   18 |         if(q.size() < 3) {
      |            ^
swap.cpp:19:21: error: 'W' was not declared in this scope
   19 |             q.push({W[i], V[i]});
      |                     ^
swap.cpp:19:27: error: 'V' was not declared in this scope
   19 |             q.push({W[i], V[i]});
      |                           ^
swap.cpp:21:33: error: 'W' was not declared in this scope
   21 |         else if(q.top().first > W[i]) {
      |                                 ^
swap.cpp:23:27: error: 'V' was not declared in this scope
   23 |             q.push({W[i], V[i]});
      |                           ^
swap.cpp:25:17: error: 'V' was not declared in this scope
   25 |         wtonode[V[i]] = W[i];
      |                 ^
swap.cpp:25:25: error: 'W' was not declared in this scope
   25 |         wtonode[V[i]] = W[i];
      |                         ^
swap.cpp:28:12: error: 'q' was not declared in this scope
   28 |     ind1 = q.top().second;
      |            ^
swap.cpp: In function 'int getMinimumFuelCapacity(int, int)':
swap.cpp:44:18: error: 'wtonode' was not declared in this scope
   44 |     int value1 = wtonode[X];
      |                  ^~~~~~~
swap.cpp:68:30: error: 'max' was not declared in this scope
   68 |     int answer = max(value1, max(value2, other));
      |                              ^~~
swap.cpp:68:18: error: 'max' was not declared in this scope
   68 |     int answer = max(value1, max(value2, other));
      |                  ^~~