Submission #633191

#TimeUsernameProblemLanguageResultExecution timeMemory
633191CauchicoThousands Islands (IOI22_islands)C++17
1.75 / 100
33 ms4172 KiB
#include "islands.h" #include <variant> #include <vector> #include <bits/stdc++.h> using namespace std; int n,m; vector<vector<int>> adj; vector<int> visited; void dfs(int v) { visited[v]++; for (auto u: adj[v]) { if (!visited[u]) { dfs(u); } else { visited[u]++; } } } variant<bool, vector<int>> find_journey( int N, int M, std::vector<int> U, std::vector<int> V) { n = N; m = M; adj.resize(n); visited.resize(n,0); for (int i=0;i<m;i++) { adj[U[i]].push_back(V[i]); } dfs(0); int ans = 0; for (auto u: visited) { ans += max(0,u-1); } if (ans >= 2) { 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...