# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
107621 | patrikpavic2 | Cop and Robber (BOI14_coprobber) | C++17 | 3 ms | 640 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 "coprobber.h"
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
int mv = 0, pos, n, m;
bool a[MAX_N][MAX_N];
int start(int N, bool A[MAX_N][MAX_N]){
for(int i = 0;i < MAX_N;i++){
for(int j = 0;j < MAX_N;j++){
a[i][j] = A[i][j];
}
}
while(A[m][m + 1]) m++;m++;
n = N / m;
return pos = (n / 2) * m + m / 2;
}
int nextMove(int R){
if(a[R][pos]) return R;
int Px = pos / m, Py = pos % m;
int Rx = R / m, Ry = R % m;
if((Px + Py) % 2 == (Rx + Ry) % 2) return pos;
if(Px == Rx) {
if(Py < Ry) return pos = pos + 1;
return pos = pos - 1;
}
if(Px < Rx) return pos = pos + m;
return pos = pos - m;
}
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... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |