제출 #1024774

#제출 시각아이디문제언어결과실행 시간메모리
1024774Issa수천개의 섬 (IOI22_islands)C++17
1.75 / 100
21 ms10580 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> pii; const int maxn = 2e5 + 100; int n; vector<pii> g[maxn]; int used[maxn]; bool dfs(int v, int i){ used[v] = 1; for(auto [to, in]: g[v]){ if(in == i) continue; if(used[to]) return 1; if(dfs(to, in)) return 1; } return 0; } std::variant<bool, std::vector<int>> find_journey( int N, int M, std::vector<int> U, std::vector<int> V){ n = N; for(int i = 0; i < M; i++){ int a = U[i] + 1, b = V[i] + 1; g[a].push_back({b, i / 2}); } return dfs(1, -1); }
#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...