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>
#include "islands.h"
using namespace std;
vector<vector<pair<int, int>>> E;
bool tr = false;
vector<bool> vis;
void dfs(int x, int p = -1) {
vis[x] = true;
for (auto [i, k] : E[x]) {
if (vis[i]) {
if (!i && p) tr = true;
continue;
}
dfs(i, x);
}
}
variant<bool, vector<int>> find_journey(int n, int M, vector<int> U, vector<int> V) {
E.assign(n, {});
for (int i = 0; i < M; i++) {
E[U[i]].push_back({V[i], i});
E[V[i]].push_back({U[i], i});
}
vis.assign(n, false);
dfs(0);
return tr;
}
# | 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... |