Submission #1225934

#TimeUsernameProblemLanguageResultExecution timeMemory
1225934paskalisapoSwapping 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.top().first > W[i] || q.size() < 3) {
            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;
    if(X == ind3 || Y == ind3) {
        other = w2;
        if(X == ind2 || Y == ind2) {
            other = w1;
        }
    }
    int answer = max(wtonode[X], max(wtonode[Y], 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.top().first > W[i] || q.size() < 3) {
      |            ^
swap.cpp:18:28: error: 'W' was not declared in this scope
   18 |         if(q.top().first > W[i] || q.size() < 3) {
      |                            ^
swap.cpp:19:27: error: 'V' was not declared in this scope
   19 |             q.push({W[i], V[i]});
      |                           ^
swap.cpp:24:12: error: 'q' was not declared in this scope
   24 |     ind1 = q.top().second;
      |            ^
swap.cpp: In function 'int getMinimumFuelCapacity(int, int)':
swap.cpp:46:22: error: 'wtonode' was not declared in this scope
   46 |     int answer = max(wtonode[X], max(wtonode[Y], other));
      |                      ^~~~~~~
swap.cpp:46:34: error: 'max' was not declared in this scope
   46 |     int answer = max(wtonode[X], max(wtonode[Y], other));
      |                                  ^~~
swap.cpp:46:18: error: 'max' was not declared in this scope
   46 |     int answer = max(wtonode[X], max(wtonode[Y], other));
      |                  ^~~