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 "islands.h"
#include <bits/stdc++.h>
using namespace std;
#define MAX 101010
int deg[MAX];
vector<int> adj[MAX];
vector<int> radj[MAX];
int chk[MAX];
int N, M;
variant<bool, vector<int>> find_journey(int N, int M, vector<int> U, vector<int> V) {
int i;
::N = N;
::M = M;
for (i = 0; i < M; i++) deg[U[i]]++, adj[U[i]].push_back(V[i]), radj[V[i]].push_back(U[i]);
queue<int> q;
for (i = 0; i < N; i++) if (!deg[i]) q.push(i);
while (q.size()) {
int t = q.front();
q.pop();
chk[t] = 1;
for (auto v : radj[t]) if (!chk[v]) {
deg[v]--;
if (deg[v] == 0) q.push(v);
}
}
if (chk[0]) return false;
else return vector<int>({ 4, 6, 3, 4 });
}
# | 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... |