답안 #418096

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
418096 2021-06-05T05:53:12 Z amunduzbaev 경찰관과 강도 (BOI14_coprobber) C++14
14 / 100
58 ms 1692 KB
#include "coprobber.h"
#include "bits/stdc++.h"

#ifndef EVAL
#include "grader.cpp"
#endif

using namespace std;

const int MAXN = 500;
int n, m, x, y;

int start(int N, bool A[MAX_N][MAX_N]){
	n = N;
	for(int i=1;i<N;i++){
		int cnt = 0;
		for(int j=0;j<N;j++) cnt += A[i][j];
		if(cnt == 2) { m = i+1; break; }
	}
	
	return 0;
}

int nextMove(int r){
	int tx = r / m, ty = r % m;
	int xd = abs(tx - x), yd = abs(ty - y);
	if(xd > yd){
		if(tx > x) x++;
		else x--;
	} if(xd < yd){
		if(ty > y) y++;
		else y--;
	} return x * m + y;
}

/*

9
0 1 0 1 0 0 0 0 0
1 0 1 0 1 0 0 0 0
0 1 0 0 0 1 0 0 0
1 0 0 0 1 0 1 0 0
0 1 0 1 0 1 0 1 0
0 0 1 0 1 0 0 0 1
0 0 0 1 0 0 0 1 0
0 0 0 0 1 0 1 0 1
0 0 0 0 0 1 0 1 0

*/
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 328 KB Execution killed with signal 8
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 200 KB Output is correct
2 Correct 1 ms 328 KB Output is correct
3 Correct 55 ms 1560 KB Output is correct
4 Correct 58 ms 1692 KB Output is correct
5 Correct 45 ms 1504 KB Output is correct
6 Correct 45 ms 1472 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Runtime error 2 ms 328 KB Execution killed with signal 8
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 328 KB Execution killed with signal 8
2 Halted 0 ms 0 KB -