제출 #1247183

#제출 시각아이디문제언어결과실행 시간메모리
1247183NekoRollyThousands Islands (IOI22_islands)C++20
10 / 100
21 ms7496 KiB
#include "islands.h" #include<bits/stdc++.h> using namespace std; const int N = 1e5+4; int n,m; vector<pair<int,int>> adj[N]; variant<bool, vector<int>> first_solve(){ return false; } variant<bool, vector<int>> second_solve(){ return false; } variant<bool, vector<int>> find_journey(int N, int M, vector<int> U, vector<int> V) { n = N, m = M; for (int i=0; i<m; i++) adj[U[i]].push_back({V[i], i}); bool first = m%2 == 0, second = m%2 == 0; for (int i=0; i<m; i+=2){ if (U[i] != V[i+1] || U[i+1] != V[i]) first = false; if (U[i] != U[i+1] || V[i] != V[i+1]) second = false; } first = second = false; if (first) return first_solve(); else if (second) return second_solve(); else if (n == 2){ if (adj[0].size() >= 2 && adj[1].size() >= 1){ int a = adj[0][0].second; int b = adj[0][1].second; int c = adj[1][0].second; vector<int> vec = {a, c, b, a, c, b}; return vec; } else return false; } else{ int a=0,b=0,c=0,d=0; for (int i=0; i<m; i++){ if (U[i] == 0 && V[i] == 1) a = i; if (U[i] == 1 && V[i] == 2) b = i; if (U[i] == 2 && V[i] == 0) c = i; if (U[i] == 0 && V[i] == 2) d = i; } vector<int> vec = {a, b, c, d, b, a, c, d}; return vec; } 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...