This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |