#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 time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |