Submission #658906

#TimeUsernameProblemLanguageResultExecution timeMemory
658906coding_snorlaxThousands Islands (IOI22_islands)C++17
10 / 100
31 ms3776 KiB
#include<bits/stdc++.h> #include "islands.h" using namespace std; variant<bool, std::vector<int>> find_journey(int N,int M,vector<int> U,vector<int> V){ if(N==2){ int Back=-1; int Front_1=-1; int Front_2=-1; vector<int> S; for(int i=0;i<M;i++){ if(!(Back+1) && U[i]==1) Back=i; else if(!(Front_1+1) && V[i]==1) Front_1=i; else if(!(Front_2+1) && V[i]==1) Front_2=i; } if(!(Back+1) || !(Front_1+1) || !(Front_2+1)) return false; S.push_back(Front_1); S.push_back(Back); S.push_back(Front_2); S.push_back(Front_1); S.push_back(Back); S.push_back(Front_2); return S; } int Node1=-1,Node2=-1,Node3=-1; int a=-1,b=-1,c=-1,d=-1; //vector<int> S; for(int i=0;i<M;i++){ if(U[i]==0 && Node1==-1){ a=i; Node1=V[i]; } else if(U[i]==0 && Node2==-1){ c=i; Node2=V[i]; } } for(int i=0;i<M;i++){ if(U[i]==Node1 && V[i]==0 && b==-1) b=i; else if(U[i]==Node2 && V[i]==0 && d==-1) d=i; } if(c!=-1){ vector<int> S={a,b,c,d,b,a,d,c}; return S; } for(int i=0;i<M;i++){ if(U[i]==Node1 && c==-1 && V[i]!=0){ c=i; Node3=V[i]; } } for(int i=0;i<M;i++){ if(U[i]==Node3 && V[i]==Node1 && d==-1) d=i; } if(c!=-1){ vector<int> S={a,b,d,c,b,d,c,a}; return S; } 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...