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;
#define rep(i,n) for(int i=0; i<(n); i++)
#define rng(i,l,r) for(int i=(l); i<(r); i++)
#define all(x) x.begin(),x.end()
using ll=long long;
std::variant<bool, std::vector<int>> find_journey(
int N, int M, std::vector<int> U, std::vector<int> V) {
if(N==2) {
vector<vector<int>> cnt(2);
rep(i,M)cnt[U[i]].emplace_back(i);
if(cnt[0].size()>=2&&cnt[1].size()>=1) {
return vector<int>{cnt[0][0],cnt[1][0],cnt[0][1],cnt[0][0],cnt[1][0],cnt[0][1]};
}
else {
return false;
}
}
bool subtask2=true;
if(N>400)subtask2=false;
array<array<vector<int>,1000>,1000> gr;
rep(i,M) {
if(gr[U[i]][V[i]].size()!=0)subtask2=false;
gr[U[i]][V[i]].emplace_back(i);
}
if(M!=N*(N-1))subtask2=false;
if(subtask2) {
vector<int> ans;
rep(i,N) {
ans.emplace_back(gr[i][(i+1)%N][0]);
}
rep(i,N) {
ans.emplace_back(gr[(N-i)%N][N-i-1][0]);
}
rep(i,N*2) {
ans.emplace_back(ans[i]);
}
return ans;
}
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... |