제출 #835872

#제출 시각아이디문제언어결과실행 시간메모리
835872APROHACK수천개의 섬 (IOI22_islands)C++17
10 / 100
37 ms56284 KiB
#include "islands.h" #define pb push_back #define ll long long #include <variant> #include <vector> using namespace std; std::variant<bool, std::vector<int>> find_journey( int N, int M, std::vector<int> U, std::vector<int> V) { int cuenta[N][N]; vector<int>parejas[N][N]; for(int i = 0 ; i < N ; i ++){ for(int j = 0 ; j < N ; j ++){ cuenta[i][j] = 0; } } for(int i = 0 ; i < M ; i ++ ){ cuenta[U[i]][V[i]] ++ ; parejas[U[i]][V[i]].pb(i); } if (N == 2) { if(cuenta[0][1] >= 2 and cuenta[1][0] >= 1){ int a = parejas[0][1][0]; int b = parejas[1][0][0]; int c = parejas[0][1][1]; vector<int>ans = {a, b, c, a, b, c}; return ans; } return false; }else{ int a = parejas[0][1][0]; int b = parejas[1][0][0]; int c = parejas[0][2][0]; int d = parejas[2][0][0]; vector<int>ans = {a, b, c, d, b, a, d, c}; return ans; } }
#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...