Submission #996678

#TimeUsernameProblemLanguageResultExecution timeMemory
996678stdfloatThousands Islands (IOI22_islands)C++17
1.75 / 100
28 ms8904 KiB
#include <bits/stdc++.h> #include "islands.h" using namespace std; vector<vector<pair<int, int>>> E; bool tr = false; vector<bool> vis; void dfs(int x, int p = -1) { vis[x] = true; for (auto [i, k] : E[x]) { if (vis[i]) { if (!i && p) tr = true; continue; } dfs(i, x); } } variant<bool, vector<int>> find_journey(int n, int M, vector<int> U, vector<int> V) { E.assign(n, {}); for (int i = 0; i < M; i++) { E[U[i]].push_back({V[i], i}); E[V[i]].push_back({U[i], i}); } vis.assign(n, false); dfs(0); return tr; }
#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...