Submission #831177

#TimeUsernameProblemLanguageResultExecution timeMemory
831177caganyanmazThousands Islands (IOI22_islands)C++17
8.40 / 100
29 ms10236 KiB
#include <bits/stdc++.h> #define pb push_back #include "islands.h" using namespace std; constexpr static int MXN = 1e5 + 5; int n, m; vector<int> u, v; vector<int> g[MXN]; int state[MXN]; bool dfs(int node) { state[node] = 1; for (int c : g[node]) { if (state[c] == 1) return true; if (state[c] == 0 && dfs(c)) return true; } 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; for (int i = 0; i < m; i++) g[u[i]].pb(v[i]); return dfs(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...