Submission #1135110

#TimeUsernameProblemLanguageResultExecution timeMemory
1135110Saul0906Thousands Islands (IOI22_islands)C++20
6.75 / 100
24 ms12224 KiB
#include "islands.h" #include <bits/stdc++.h> #define rep(a,b,c) for(ll a=b; a<c; a++) #define repr(a,b,c) for(ll a=b-1; a>c-1; a--) #define repa(a,b) for(auto a:b) #define ll long long #define pll pair<ll, ll> #define pii pair<int, int> #define fi first #define se second #define pb push_back #define mid ((l+r)>>1) #define ppb pop_back() using namespace std; using vi = vector<int>; template<typename T> using vec = vector<T>; const int n=2e5+5; vec<pii> adj[n]; std::variant<bool, std::vector<int>> find_journey( int N, int M, std::vector<int> U, std::vector<int> V) { if(N==2){ vi a, b, ans; rep(i,0,M){ if(U[i]==0) a.pb(i); else b.pb(i); } if(a.size()<2 || b.size()<1) return false; ans={a[0],b[0],a[1],a[0],b[0],a[1]}; return ans; } rep(i,0,N) adj[i].clear(); rep(i,0,M) adj[U[i]].pb({V[i],i}); rep(i,0,M) adj[V[i]].pb({U[i],i}); if(adj[0].size()>=4) return true; repa(e,adj[0]) if(adj[e.fi].size()>=4) return true; 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...