Submission #628141

#TimeUsernameProblemLanguageResultExecution timeMemory
628141TurkhuuThousands Islands (IOI22_islands)C++17
Compilation error
0 ms0 KiB
#include "islands.h" #include <bits/stdc++.h> using namespace std; variant<bool, vector<int>> find_journey(int N, int M, vector<int> U, vector<int> V) { if (N == 2) { return false; } vector<int> A(N), B(N); for (int i = 0; i < M; i++) { if ((U[i] + 1) % N == V[i]) { A[U[i]] = i; } if (V[i] + 1) % N == U[i]) { B[U[i]] = i; } } vector<int> ans; for (int i = 0; i < N; i++) { ans.push_back(A[i]); } for (int i = N - 1; i >= 0; i--) { ans.push_back(B[(i + 1) % N]); } for (int i = N - 1; i >= 0; i--) { ans.push_back(A[i]); } for (int i = 0; i < N; i++) { ans.push_back(B[(i + 1) % N]); } return ans; }

Compilation message (stderr)

islands.cpp: In function 'std::variant<bool, std::vector<int, std::allocator<int> > > find_journey(int, int, std::vector<int>, std::vector<int>)':
islands.cpp:13:19: error: expected primary-expression before '%' token
   13 |     if (V[i] + 1) % N == U[i]) {
      |                   ^