Submission #1028831

#TimeUsernameProblemLanguageResultExecution timeMemory
1028831MardonbekhazratovThousands Islands (IOI22_islands)C++17
10 / 100
26 ms6696 KiB
#include "islands.h" #include <variant> #include <vector> #include <tuple> using namespace std; int n,m; vector<int>u,v; variant<bool,vector<int>>sub1(){ vector<int>c1,c2; for(int i=0;i<m;i++){ if(u[i]==0) c1.push_back(i); else c2.push_back(i); } if(c1.size()<2 || c2.size()<1) return false; return vector<int>({c1[0],c2[0],c1[1],c1[0],c2[0],c1[1]}); } vector<int>sub2(){ vector<vector<int>>a(3,vector<int>(3)); for(int i=0;i<m;i++){ if(u[i]<3 && v[i]<3) a[u[i]][v[i]]=i; } return vector<int>({a[0][1],a[1][0],a[0][2],a[2][1],a[0][1],a[1][0],a[2][1],a[0][2]}); } std::variant<bool, std::vector<int>> find_journey(int N, int M, std::vector<int> U, std::vector<int> V) { tie(n,m,u,v)=tie(N,M,U,V); if(n==2) return sub1(); else return sub2(); }
#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...