Submission #1362139

#TimeUsernameProblemLanguageResultExecution timeMemory
1362139SulASwapping Cities (APIO20_swap)C++20
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>
using namespace std;

vector<int> U, V, W, pos;

void init(int n, int m, vector<int> _U, vector<int> _V, vector<int> _W) {
    U = _U;
    V = _V;
    W = _W;
    ranges::sort(views::zip(V, W));
    pos.resize(n-1);
    ranges::iota(pos, 1);
    ranges::sort(pos, [&](int x, int y) { return pos[x] < pos[y]; });
}

int getMinimumFuelCapacity(int x, int y) {
    for (int z : pos) {
        if (x != z && x != y) {
            return max(W[x], max(W[y], W[z]));
        }
    }
    return -1;
}

Compilation message (stderr)

swap.cpp: In function 'void init(int, int, std::vector<int>, std::vector<int>, std::vector<int>)':
swap.cpp:10:25: error: 'zip' is not a member of 'std::views'
   10 |     ranges::sort(views::zip(V, W));
      |                         ^~~
swap.cpp:12:13: error: 'iota' is not a member of 'std::ranges'
   12 |     ranges::iota(pos, 1);
      |             ^~~~
swap.cpp:12:13: note: suggested alternatives:
In file included from /usr/include/c++/13/numeric:62,
                 from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:58,
                 from swap.cpp:1:
/usr/include/c++/13/bits/stl_numeric.h:88:5: note:   'std::iota'
   88 |     iota(_ForwardIterator __first, _ForwardIterator __last, _Tp __value)
      |     ^~~~
In file included from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:89:
/usr/include/c++/13/ranges:716:26: note:   'std::ranges::views::iota'
  716 |   inline constexpr _Iota iota{};
      |                          ^~~~