Submission #1024774

#TimeUsernameProblemLanguageResultExecution timeMemory
1024774IssaThousands Islands (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...