Submission #831191

#TimeUsernameProblemLanguageResultExecution timeMemory
831191caganyanmazThousands Islands (IOI22_islands)C++17
3.50 / 100
27 ms8044 KiB
#include <bits/stdc++.h> #define pb push_back #include "islands.h" using namespace std; #ifdef DEBUGGING #include "../debug.h" #else #define debug(x...) void(42) #endif constexpr static int MXN = 1e5 + 5; int n, m; vector<int> u, v; vector<array<int, 2>> g[MXN]; int state[MXN]; vector<int> path; bool dfs(int node) { state[node] = 1; for (auto [c, e] : g[node]) { path.pb(e); if (state[c] == 1) return true; if (state[c] == 0 && dfs(c)) return true; path.pop_back(); } state[node] = 2; return false; } variant<bool, vector<int>> find_journey(int N, int M, vector<int> U, vector<int> V) { n = N, m = M; u = U, v = V; int lcount = 0, rcount = 0; for (int j = 0; j < m; j++) if (u[j] == 0) lcount++; else rcount++; return lcount > 1 && rcount > 0; }
#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...