#include "treasure.h"
#include <bits/stdc++.h>
using namespace std;
const int MAX = 111;
int val[MAX][MAX];
void findTreasure(int N) {
int total = countTreasure(1, N, 1, N);
int mid = N / 2;
for (int i = N; i >= 1; i--) {
for (int j = N; j >= 1; j--) {
if (i >= mid && j >= mid) {
val[i][j] = countTreasure(1, i, 1, j);
} else if (i >= mid && j < mid) {
val[i][j] = val[i][N] - countTreasure(1, i, j + 1, N);
} else if (i < mid && j >= mid) {
val[i][j] = val[N][j] - countTreasure(i + 1, N, 1, j);
} else {
val[i][j] = -(total - val[i][N] - val[N][j] - countTreasure(i + 1, N, j + 1, N));
}
}
}
for (int i = 1; i <= N; i++) {
for (int j = 1; j <= N; j++) {
int c = val[i][j] - val[i - 1][j] - val[i][j - 1] + val[i - 1][j - 1];
if (c == 1) {
Report(i, j);
}
}
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
348 KB |
Error - check the range of the parameters of countTreasure() : r1 = 1, c1 = 5, r2 = 1, c2 = 4 |
2 |
Incorrect |
0 ms |
348 KB |
Error - check the range of the parameters of countTreasure() : r1 = 1, c1 = 10, r2 = 1, c2 = 9 |
3 |
Incorrect |
0 ms |
348 KB |
Error - check the range of the parameters of countTreasure() : r1 = 1, c1 = 15, r2 = 1, c2 = 14 |
4 |
Incorrect |
0 ms |
348 KB |
Error - check the range of the parameters of countTreasure() : r1 = 1, c1 = 16, r2 = 1, c2 = 15 |
5 |
Incorrect |
0 ms |
348 KB |
Error - check the range of the parameters of countTreasure() : r1 = 1, c1 = 55, r2 = 1, c2 = 54 |
6 |
Incorrect |
0 ms |
348 KB |
Error - check the range of the parameters of countTreasure() : r1 = 1, c1 = 66, r2 = 1, c2 = 65 |
7 |
Incorrect |
0 ms |
348 KB |
Error - check the range of the parameters of countTreasure() : r1 = 1, c1 = 77, r2 = 1, c2 = 76 |
8 |
Incorrect |
0 ms |
348 KB |
Error - check the range of the parameters of countTreasure() : r1 = 1, c1 = 88, r2 = 1, c2 = 87 |
9 |
Incorrect |
0 ms |
348 KB |
Error - check the range of the parameters of countTreasure() : r1 = 1, c1 = 99, r2 = 1, c2 = 98 |
10 |
Incorrect |
0 ms |
348 KB |
Error - check the range of the parameters of countTreasure() : r1 = 1, c1 = 100, r2 = 1, c2 = 99 |