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 mp make_pair
#define all(a) a.begin(),a.end()
#define X first
#define Y second
using namespace std;
using pii = pair <long long, long long>;
constexpr int maxn = 2e5 + 10;
constexpr int mod = 1000002022;
constexpr long long inf = 1e17 + 10;
int n, m;
vector <pii> graph [maxn];
bool used [maxn];
int tree = true;
inline void dfs (int v, int par = maxn) {
used[v] = true;
for (pii i : graph[v]) if ((i.Y ^ par) != 1) {
if (used[i.X]) {
tree = false;
continue;
}
dfs (i.X, i.Y);
}
}
variant <bool, vector <int>> find_journey (int N, int M, vector <int> U, vector <int> V) {
n = N, m = M;
for (int i = 0; i < m; ++i) {
graph[U[i]].push_back (mp (V[i], i));
}
dfs (0);
return !tree;
}
# | 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... |