#include<bits/stdc++.h>
#include "coprobber.h"
int n, s, timer;
int p[1000], tin[1000], tout[1000];
bool ind;
bool g[1000][1000];
bool used[1000];
void DFS(int f, int pr) {
p[f] = pr;
tin[f] = ++timer;
used[f] = 1;
for(int i = 0; i < n; i++) {
if(!g[f][i] || i == pr) continue;
if(used[i]) ind = 1;
DFS(i,f);
}
tout[f] = timer;
}
bool upper(int x, int y) {
return ((tin[x] <= tin[y]) && (tout[x] >= tout[y]));
}
int start(int N, bool A[MAX_N][MAX_N]) {
n = N; s = 0;
for(int i = 0; i < n; i++)
for(int j = 0; j < n; j++)
g[i][j] = A[i][j];
DFS(0, -1);
if(ind) return -1;
return 0;
}
int nextMove(int R) {
for(int i = 0; i < n; i++) {
if(!g[s][i] || i == p[s]) continue;
if(upper(i,R)) return i;
}
return s;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
384 KB |
Output is correct |
2 |
Correct |
2 ms |
384 KB |
Output is correct |
3 |
Incorrect |
2 ms |
384 KB |
the situation repeated |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
233 ms |
262144 KB |
Execution killed with signal 9 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
384 KB |
Output is correct |
2 |
Correct |
2 ms |
384 KB |
Output is correct |
3 |
Incorrect |
2 ms |
384 KB |
the situation repeated |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
384 KB |
Output is correct |
2 |
Correct |
2 ms |
384 KB |
Output is correct |
3 |
Incorrect |
2 ms |
384 KB |
the situation repeated |
4 |
Halted |
0 ms |
0 KB |
- |