Submission #837464

#TimeUsernameProblemLanguageResultExecution timeMemory
837464NothingXDThousands Islands (IOI22_islands)C++17
0 / 100
25 ms6496 KiB
#include "islands.h" #include<bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int,int> pii; typedef pair<ll,ll> pll; void debug_out(){cerr<<endl;} template<typename Head, typename... Tail> void debug_out(Head H, Tail... T){ cerr << H << ' '; debug_out(T...); } #define debug(...) cerr << "(" << #__VA_ARGS__ << "): ", debug_out(__VA_ARGS__) #define F first #define S second #define all(x) x.begin(), x.end() #define MP(x, y) make_pair(x, y) const int maxn = 1e5 + 10; int n, m; vector<int> g[maxn]; bool vis[maxn]; bool dfs(int v, int p = -1){ vis[v] = true; for (auto u: g[v]){ if (!vis[u] && dfs(u, v)){ return true; } else if (vis[u] && u != p){ // debug(v, u); return true; } } return false; } std::variant<bool, std::vector<int>> find_journey( int N, int M, std::vector<int> U, std::vector<int> V) { n = N, m = M; for (int i = 0; i < m; i++){ g[U[i]].push_back(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...