제출 #1247532

#제출 시각아이디문제언어결과실행 시간메모리
1247532ereringThousands Islands (IOI22_islands)C++20
10 / 100
19 ms3396 KiB
#include <bits/stdc++.h> #include "islands.h" using namespace std; variant<bool, vector<int>> find_journey(int N, int M, vector<int> U, vector<int> V) { if(N==2) { pair<int, int> p = {-1, -1}; int idx = -1; for (int i = 0; i < M; i++) { if (U[i] == 0 && V[i] == 1) { if (p.first == -1)p.first = i; else p.second = i; } if (U[i] == 1 && V[i] == 0)idx = i; } if (p.second == -1 || idx == -1)return false; return vector<int>{p.first, idx, p.second, p.first, idx, p.second}; } else{ pair<int,int> p1,p2,p3; for(int i=0;i<M;i++){ if(U[i]==0 && V[i]==1)p1.first=i; if(U[i]==1 && V[i]==0)p1.second=i; if(U[i]==1 && V[i]==2)p2.first=i; if(U[i]==2 && V[i]==1)p2.second=i; if(U[i]==2 && V[i]==0)p3.first=i; if(U[i]==0 && V[i]==2)p3.second=i; } return vector<int>{p1.first,p2.first,p3.first,p3.second,p2.second,p1.second,p3.first,p2.first,p1.first,p1.second,p2.second,p3.second}; } }
#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...