# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1051197 | Trent | Thousands Islands (IOI22_islands) | C++17 | 18 ms | 5212 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 "bits/stdc++.h"
using namespace std;
#define forR(i, x) for(int i = 0; i < (x); ++i)
#define REP(i, a, b) for(int i = (a); i < (b); ++i)
#define all(x) x.begin(), x.end()
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
typedef vector<bool> vb;
struct edge{int t, i;};
vector<vector<edge>> adj;
std::variant<bool, std::vector<int>> find_journey(
int N, int M, std::vector<int> U, std::vector<int> V) {
adj.resize(N);
forR(i, M) {
adj[U[i]].push_back({V[i], i});
}
if(N == 2) {
if(adj[0].size() < 2 || adj[1].size() < 1) return false;
else {
return vector<int> {adj[0][0].i, adj[1][0].i, adj[0][1].i, adj[0][0].i, adj[1][0].i, adj[0][1].i};
}
} else {
int ab, ba, ac, ca;
forR(i, M) {
if(U[i] == 0 && V[i] == 1) ab = i;
else if(U[i] == 1 && V[i] == 0) ba = i;
else if(U[i] == 0 && V[i] == 2) ac = i;
else if(U[i] == 2 && V[i] == 0) ca = i;
}
return vector<int> {ab, ba, ac, ca, ba, ab, ca, ac};
}
}
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... |