Submission #706369

#TimeUsernameProblemLanguageResultExecution timeMemory
706369danikoynovThousands Islands (IOI22_islands)C++17
6.75 / 100
33 ms6964 KiB
#include "islands.h" #include <variant> #include <vector> using namespace std; const int maxn = 1010; int edge_index[maxn][maxn], deg[maxn]; std::variant<bool, std::vector<int>> find_journey( int N, int M, std::vector<int> U, std::vector<int> V) { bool spec = true; for (int i = 0; i < M; i += 2) { if (V[i] != U[i + 1] || U[i] != V[i + 1]) spec = false; } if (N == 2) { int cnt0 = 0, cnt1 = 0; vector < int > idx0, idx1; for (int i = 0; i < M; i ++) { if (U[i] == 0) cnt0 ++, idx0.push_back(i); else cnt1 ++, idx1.push_back(i); } if (cnt0 >= 2 && cnt1 >= 1) { vector < int > path; path.push_back(idx0[0]); path.push_back(idx1[0]); path.push_back(idx0[1]); path.push_back(idx0[0]); path.push_back(idx1[0]); path.push_back(idx0[1]); return path; } return false; } else if (spec) { for (int i = 0; i < M; i ++) { if (U[i] == 0) deg[0] ++; } if (deg[0] == 1) return false; return true; } else { for (int i = 0; i < M; i ++) edge_index[U[i]][V[i]] = i; vector < int > path; path.push_back(edge_index[0][1]); path.push_back(edge_index[1][0]); path.push_back(edge_index[0][2]); path.push_back(edge_index[2][0]); path.push_back(edge_index[1][0]); path.push_back(edge_index[0][1]); path.push_back(edge_index[2][0]); path.push_back(edge_index[0][2]); return path; } }
#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...