#include <bits/stdc++.h>
#include "treasure.h"
using namespace std;
int B[105][105][4];
int q(int a, int b, int c, int d) {
return countTreasure(a, b, c, d);
}
void r(int a, int b) {
Report(a, b);
}
void findTreasure(int N) {
if(N==1) {
if(q(1, 1, 1, 1)) r(1, 1);
return;
}
int d = N / 2;
//1 ~ d, d+1 ~ N
int i, j;
for(i=d;i<=N;i++) {
for(j=d;j<=N;j++) {
B[i][j][0] = q(1, 1, i, j);
}
}
for(i=d+1;i<=N;i++) {
for(j=d+1;j<=N;j++) {
int v = B[i][j][0] - B[i][j-1][0] - B[i-1][j][0] + B[i-1][j-1][0];
if(v) r(i, j);
}
}
for(i=d;i<=N;i++) {
for(j=1;j<=d+1;j++) {
B[i][j][1] = q(1, j, i, N);
}
}
for(i=d+1;i<=N;i++) {
for(j=1;j<=d;j++) {
int v = B[i][j][1] - B[i-1][j][1] - B[i][j+1][1] + B[i-1][j+1][1];
if(v) r(i, j);
}
}
for(i=1;i<=d+1;i++) {
for(j=1;j<=d+1;j++) {
B[i][j][2] = q(i, j, N, N);
}
}
for(i=1;i<=d;i++) {
for(j=1;j<=d;j++) {
int v = B[i][j][2] - B[i+1][j][2] - B[i][j+1][2] + B[i+1][j+1][2];
if(v) r(i, j);
}
}
for(i=1;i<=d+1;i++) {
for(j=d;j<=N;j++) {
B[i][j][3] = q(i, 1, N, j);
}
}
for(i=1;i<=d;i++) {
for(j=d+1;j<=N;j++) {
int v = B[i][j][3] - B[i+1][j][3] - B[i][j-1][3] + B[i+1][j-1][3];
if(v) r(i, j);
}
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
Error - you cannot call countTreasure() after calling Report() |
2 |
Incorrect |
0 ms |
340 KB |
Error - you cannot call countTreasure() after calling Report() |
3 |
Incorrect |
0 ms |
340 KB |
Error - you cannot call countTreasure() after calling Report() |
4 |
Incorrect |
0 ms |
308 KB |
Error - you cannot call countTreasure() after calling Report() |
5 |
Incorrect |
0 ms |
340 KB |
Error - you cannot call countTreasure() after calling Report() |
6 |
Incorrect |
1 ms |
312 KB |
Error - you cannot call countTreasure() after calling Report() |
7 |
Incorrect |
1 ms |
340 KB |
Error - you cannot call countTreasure() after calling Report() |
8 |
Incorrect |
1 ms |
340 KB |
Error - you cannot call countTreasure() after calling Report() |
9 |
Incorrect |
1 ms |
468 KB |
Error - you cannot call countTreasure() after calling Report() |
10 |
Incorrect |
1 ms |
340 KB |
Error - you cannot call countTreasure() after calling Report() |