제출 #1072962

#제출 시각아이디문제언어결과실행 시간메모리
1072962beaconmc수천개의 섬 (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...