Submission #1072962

#TimeUsernameProblemLanguageResultExecution timeMemory
1072962beaconmcThousands Islands (IOI22_islands)C++17
0 / 100
24 ms8024 KiB
#include "islands.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; #define FOR(i,x,y) for(ll i=x; i<y; i++) #define FORNEG(i,x,y) for(ll i=x; i>y; i--) const ll maxn = 100005; vector<int> edges[maxn]; bool visited[maxn]; bool flag = 0; void dfs(ll a){ visited[a] = 1; for (auto&i : edges[a]){ if (visited[i]) flag = 1; else{ visited[i] = 1; dfs(i); } } } std::variant<bool, std::vector<int>> find_journey( int N, int M, std::vector<int> U, std::vector<int> V) { FOR(i,0,maxn) visited[i] = 0; FOR(i,0,maxn) edges[i].clear(); FOR(i,0,M){ edges[U[i]].push_back(V[i]); } dfs(0); if (flag==1) return true; else 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...