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 <bits/stdc++.h>
using namespace std;
vector<int> g[MAX_N];
int pos = 0, width = 1;
int start(int N, bool A[MAX_N][MAX_N]) {
for (int i = 0; i < N; i++) {
for (int k = 0; k < N; k++) {
if (A[i][k]) {
g[i].push_back(k);
}
}
}
while (g[width].size() == 3) width++;
width++;
return 0;
}
int nextMove(int R) {
int copX = pos % width, copY = pos / width;
int robberX = R % width, robberY = R / width;
int distX = abs(copX - robberX), distY = abs(copY - robberY);
if (distX > distY)
return pos = pos + (robberX < copX ? -1 : 1);
else if (distY > distX)
return pos = pos + (robberY < copY ? -1 : 1) * width;
else
return pos;
}
# | 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... |