# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
736872 | onlk97 | Thousands Islands (IOI22_islands) | C++17 | 60 ms | 49432 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>
#include <bits/stdc++.h>
using namespace std;
vector <int> bruh[1010][1010];
std::variant<bool, std::vector<int>> find_journey(int N, int M, std::vector<int> U, std::vector<int> V) {
if (N==2){
vector <int> a,b;
for (int i=0; i<M; i++){
if (!U[i]) a.push_back(i);
else b.push_back(i);
}
if (a.size()>=2&&b.size()){
vector <int> ans;
ans.push_back(a[0]); ans.push_back(b[0]); ans.push_back(a[1]);
ans.push_back(a[0]); ans.push_back(b[0]); ans.push_back(a[1]);
return ans;
}
return false;
}
bool subtask2=(N<=400);
bool subtask3=(N<=1000);
if (N<=1000){
for (int i=0; i<M; i++){
bruh[U[i]][V[i]].push_back(i);
}
for (int i=0; i<N; i++){
for (int j=0; j<N; j++){
if (i==j) continue;
if (bruh[i][j].size()!=1) subtask2=0;
}
}
for (int i=0; i<N; i++){
for (int j=i+1; j<N; j++){
if (bruh[i][j].size()!=bruh[j][i].size()) subtask3=0;
}
}
}
if (subtask2){
vector <int> ans;
ans.push_back(bruh[0][1][0]);
ans.push_back(bruh[1][0][0]);
ans.push_back(bruh[0][2][0]);
ans.push_back(bruh[2][0][0]);
ans.push_back(bruh[1][0][0]);
ans.push_back(bruh[0][1][0]);
ans.push_back(bruh[2][0][0]);
ans.push_back(bruh[0][2][0]);
return ans;
}
}
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... |