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;
const int N = 1e5 + 10;
vector < pair <int, int> > g[N];
int conn[500][500];
variant<bool, vector<int>> find_journey(int N, int M, vector<int> U, vector<int> V) {
for (int i = 0; i < M; i++) {
g[U[i]].emplace_back(V[i], i);
}
if (N == 2) {
if (g[0].size() >= 2 && g[1].size() >= 1) {
vector <int> ans;
ans.push_back(g[0][0].second);
ans.push_back(g[1][0].second);
ans.push_back(g[0][1].second);
ans.push_back(g[0][0].second);
ans.push_back(g[1][0].second);
ans.push_back(g[0][1].second);
return ans;
} else return false;
}
if (N <= 400) {
for (int i = 0; i < N; i++)
for (int j = 0; j < N; j++)
conn[i][j] = -1;
for (int i = 0; i < M; i++)
conn[U[i]][V[i]] = i;
bool sub2 = true;
for (int i = 0; i < 3; i++)
for (int j = 0; j < 3; j++)
if (i != j && conn[i][j] == -1)
sub2 = false;
if (sub2) {
vector <int> ans;
ans.push_back(conn[0][1]);
ans.push_back(conn[1][2]);
ans.push_back(conn[2][0]);
ans.push_back(conn[0][2]);
ans.push_back(conn[2][1]);
ans.push_back(conn[1][0]);
ans.push_back(conn[2][0]);
ans.push_back(conn[1][2]);
ans.push_back(conn[0][1]);
ans.push_back(conn[1][0]);
ans.push_back(conn[2][1]);
ans.push_back(conn[0][2]);
return ans;
}
}
return false;
if (N == 4) {
return vector<int>({0, 1, 2, 4, 0, 3, 2, 1, 4, 3});
}
return false;
}
# | 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... |