Submission #1225920

#TimeUsernameProblemLanguageResultExecution timeMemory
1225920paskalisapoSwapping 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;
void init(int N, int M,
    std::vector<int> U, std::vector<int> V, std::vector<int> W) {
    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) {
    int other = w3;
    if(X == ind3 || Y == ind3) {
        other = w2;
        if(X == ind2 || Y == ind2) {
            other = w1;
        }
    }
    if(wtonode[X] == -1 || wtonode[Y] == -1) {
        return -1;
    }
    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:7:5: error: 'std::vector' has not been declared
    7 |     std::vector<int> U, std::vector<int> V, std::vector<int> W) {
      |     ^~~
swap.cpp:7:16: error: expected ',' or '...' before '<' token
    7 |     std::vector<int> U, std::vector<int> V, std::vector<int> W) {
      |                ^
swap.cpp: In function 'void init(int, int, int)':
swap.cpp:10:20: error: 'pair' was not declared in this scope
   10 |     priority_queue<pair<int,int>> q;
      |                    ^~~~
swap.cpp:10:5: error: 'priority_queue' was not declared in this scope
   10 |     priority_queue<pair<int,int>> q;
      |     ^~~~~~~~~~~~~~
swap.cpp:10:25: error: expected primary-expression before 'int'
   10 |     priority_queue<pair<int,int>> q;
      |                         ^~~
swap.cpp:11:5: error: 'wtonode' was not declared in this scope
   11 |     wtonode.resize(N , -1);
      |     ^~~~~~~
swap.cpp:13:12: error: 'q' was not declared in this scope
   13 |         if(q.top().first > W[i] || q.size() < 3) {
      |            ^
swap.cpp:13:28: error: 'W' was not declared in this scope
   13 |         if(q.top().first > W[i] || q.size() < 3) {
      |                            ^
swap.cpp:14:27: error: 'V' was not declared in this scope
   14 |             q.push({W[i], V[i]});
      |                           ^
swap.cpp:19:12: error: 'q' was not declared in this scope
   19 |     ind1 = q.top().second;
      |            ^
swap.cpp: In function 'int getMinimumFuelCapacity(int, int)':
swap.cpp:38:8: error: 'wtonode' was not declared in this scope
   38 |     if(wtonode[X] == -1 || wtonode[Y] == -1) {
      |        ^~~~~~~
swap.cpp:41:22: error: 'wtonode' was not declared in this scope
   41 |     int answer = max(wtonode[X], max(wtonode[Y], other));
      |                      ^~~~~~~
swap.cpp:41:34: error: 'max' was not declared in this scope
   41 |     int answer = max(wtonode[X], max(wtonode[Y], other));
      |                                  ^~~
swap.cpp:41:18: error: 'max' was not declared in this scope
   41 |     int answer = max(wtonode[X], max(wtonode[Y], other));
      |                  ^~~