Submission #1076977

#TimeUsernameProblemLanguageResultExecution timeMemory
1076977mariaclaraThousands Islands (IOI22_islands)C++17
8.40 / 100
27 ms6340 KiB
#include "islands.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int,int> pii; #define all(x) x.begin(), x.end() #define sz(x) (int)x.size() #define pb push_back #define mk make_pair #define fr first #define sc second vector<int> vis, block, at; vector<vector<pii>> edges; vector<int> dfs(int x) { vis[x] = 1; for(auto [viz,ind] : edges[x]) { if(block[viz]) continue; if(vis[viz]) { at.pb(ind); return at; } at.pb(ind); vector<int> v = dfs(viz); if(!v.empty()) return v; } block[x] = 1; return {}; } variant<bool, vector<int>> find_journey(int N, int M, vector<int> U, vector<int> V) { edges.resize(N); vis.resize(N); block.resize(N); for(int i = 0; i < M; i += 2) edges[U[i]].pb({V[i], i}); vector<int> c = dfs(0); if(c.empty()) return false; return true; }
#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...