This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
#define pb push_back
#include "islands.h"
using namespace std;
constexpr static int MXN = 1e5 + 5;
int n, m;
vector<int> u, v;
vector<int> g[MXN];
bitset<MXN> visited;
bool dfs(int node)
{
visited[node] = true;
for (int c : g[node])
{
if (visited[c])
return true;
if (dfs(c))
return true;
}
visited[node] = false;
return false;
}
variant<bool, vector<int>> find_journey(int N, int M, vector<int> U, vector<int> V)
{
n = N, m = M;
u = U, v = V;
for (int i = 0; i*2 < n; i++)
{
g[u[i*2]].pb(v[i*2]);
g[v[i*2]].pb(u[i*2]);
}
return dfs(0);
}
# | 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... |