#include <bits/stdc++.h>
using namespace std;
#define MAX_N 500
// modify the following functions
// you can define global variables and functions
std::vector<int> con[MAX_N];
int start(int N, bool A[MAX_N][MAX_N]) {
int count=0;
for(int i=0;i!=N;++i){
for(int j=0;j!=N;++j){
if(i==j)continue;
if(A[i][j]){
con[i].push_back(j);
++count;
}
}
}
assert(count==2*(N-1));
return rand()%N;
}
int obj=0;
int dfs(int pos,int prev=-1){
if(pos==obj){
return pos;
}
for(auto&x:con[pos]){
if(x==prev)continue;
if(dfs(x,pos)){
return x;
}
}
return -1;
}
int atual=0,previi=-1;
int nextMove(int R) {
obj=R;
int strat = dfs(atual,previi);
assert(strat!=-1);
previi=atual;
return atual=strat;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
208 KB |
Output is correct |
2 |
Incorrect |
0 ms |
208 KB |
nextMove() returned a value that is either outside 0..N-1 or the new cop position is not a neighbour to the previous one |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
1 ms |
464 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
208 KB |
Output is correct |
2 |
Incorrect |
0 ms |
208 KB |
nextMove() returned a value that is either outside 0..N-1 or the new cop position is not a neighbour to the previous one |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
208 KB |
Output is correct |
2 |
Incorrect |
0 ms |
208 KB |
nextMove() returned a value that is either outside 0..N-1 or the new cop position is not a neighbour to the previous one |
3 |
Halted |
0 ms |
0 KB |
- |