Submission #1057983

#TimeUsernameProblemLanguageResultExecution timeMemory
1057983hirayuu_ojThousands Islands (IOI22_islands)C++17
10 / 100
38 ms31388 KiB
#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) { ans.emplace_back(gr[N-i-1][(N-i)%N][0]); } rep(i,N) { ans.emplace_back(gr[(i+1)%N][i][0]); } return ans; } return false; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...