# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
572585 | model_code | Naboj (COCI22_naboj) | C++17 | 328 ms | 14692 KiB |
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>
using namespace std;
const int N=2e5+5;
int n, m;
vector <int> ls[N], topo;
int in[N], bio[N];
queue <int> Q;
void dfs(int node) {
if (bio[node] == 1) {
printf("-1\n");
exit(0);
}
if (bio[node] == 2) return;
bio[node] = 1;
for (int x:ls[node]) dfs(x);
bio[node] = 2;
}
void solve() {
for (int i=1; i<=n; ++i) {
if (!bio[i]) dfs(i);
if (in[i] == 0) {
Q.push(i);
}
}
while (!Q.empty()) {
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |