# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
825724 | top34051 | Thousands Islands (IOI22_islands) | C++17 | 23 ms | 4356 KiB |
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 <variant>
#include <vector>
std::variant<bool, std::vector<int>> find_journey(int N, int M,
std::vector<int> U,
std::vector<int> V) {
// Subtask 1
if (N == 2) {
std::vector<int> way, yaw;
for (int i = 0; i < M; ++i) {
int u = U[i], v = V[i];
if (u == 0) {
way.push_back(i);
} else {
yaw.push_back(i);
}
}
if ((int)way.size() >= 2 && (int)yaw.size() >= 1) {
return std::vector({way[0], yaw[0], way[1], way[0], yaw[0], way[1]});
}
}
// Subtask 2
if (N >= 2) {
std::vector<std::vector<int>> id(3, std::vector<int>(3, -1));
for (int i = 0; i < M; ++i) {
int u = U[i], v = V[i];
if (u * v == 0 && u <= 2 && v <= 2) {
id[u][v] = i;
}
}
if (id[0][1] != -1 && id[1][0] != -1 && id[0][2] != -1 && id[2][0] != -1) {
return std::vector({id[0][1], id[1][0], id[0][2], id[2][0], id[1][0],
id[0][1], id[2][0], id[0][2]});
}
}
return false;
}
Compilation message (stderr)
# | 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... |