| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 41690 | gabrielsimoes | 경찰관과 강도 (BOI14_coprobber) | C++14 | 0 ms | 0 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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 cop = cop + (robberX < copX ? -1 : 1);
else if (distY > distX)
return cop = cop + (robberY < copY ? -1 : 1) * width;
else
return cop;
}
