제출 #837796

#제출 시각아이디문제언어결과실행 시간메모리
837796ALeonidou수천개의 섬 (IOI22_islands)C++17
1.75 / 100
26 ms4148 KiB
#include "islands.h" #include <variant> #include <bits/stdc++.h> using namespace std; #define ll int #define sz(x) (ll)x.size() #define F first #define S second #define MID ((l+r)/2) #define pb push_back #define dbg(x) cout<<#x<<": "<<x<<endl; #define dbg2(x,y) cout<<#x<<": "<<x<<" "<<#y<<": "<<y<<endl; #define dbg3(x,y,z) cout<<#x<<": "<<x<<" "<<#y<<": "<<y<<" "<<#z<<": "<<z<<endl; #define dbg4(x,y,z,w) cout<<#x<<": "<<x<<" "<<#y<<": "<<y<<" "<<#z<<": "<<z<<" "<<#w<<": "<<w<<endl; #define dbg5(x,y,z,w,q) cout<<#x<<": "<<x<<" "<<#y<<": "<<y<<" "<<#z<<": "<<z<<" "<<#w<<": "<<w<<" "<<#q<<": "<<q<<endl; #define ins insert typedef vector <ll> vi; typedef pair <ll,ll> ii; typedef vector <ii> vii; #define MOD 1000002022 #define inf 1e9 vector <vi> adj; vi vis; bool dfs(ll u){ vis[u] = 1; if (sz(adj[u]) > 1) return true; for (ll i=0; i<sz(adj[u]); i++){ ll x =adj[u][i]; if (!vis[x]){ if (dfs(x)) return true; } } return false; } variant<bool, vi> find_journey(int N, int M, vi U, vi V){ ll n = N, m = M; ll c =0; adj.assign(n, vi()); for (ll i=0; i<m;i++){ adj[U[i]].pb(V[i]); if (U[i] == 0) c++; } vis.assign(n, 0); bool ans = dfs(0); return ans; }
#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...