#include "treasure.h"
#define N 100
void findTreasure(int n) {
static int aa[N][N];
int i, j;
for (i = 0; i < n; i++)
for (j = 0; j < n; j++) {
int i1, i2, j1, j2;
if (i + 1 >= n - 1 - i)
i1 = 0, i2 = i;
else
i1 = i + 1, i2 = n - 1;
if (j + 1 >= n - 1 - j)
j1 = 0, j2 = j;
else
j1 = j + 1, j2 = n - 1;
aa[i][j] = countTreasure(i1, j1, i2, j2);
}
for (i = 0; i < n; i++)
for (j = 0; j < n; j++)
if (i + 1 < n - 1 - i && j + 1 < n - 1 - j)
aa[i][j] = aa[n - 1][n - 1] - aa[n - 1][j] - aa[i][n - 1] + aa[i][j];
else if (i + 1 < n - 1 - i)
aa[i][j] = aa[n - 1][j] - aa[i][j];
else if (j + 1 < n - 1 - j)
aa[i][j] = aa[i][n - 1] - aa[i][j];
for (i = 0; i < n; i++)
for (j = n - 1; j > 0; j--)
aa[i][j] -= aa[i][j - 1];
for (j = 0; j < n; j++)
for (i = n - 1; i > 0; i--)
aa[i][j] -= aa[i - 1][j];
for (i = 0; i < n; i++)
for (j = 0; j < n; j++)
if (aa[i][j])
Report(i, j);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
Error - check the range of the parameters of countTreasure() : r1 = 1, c1 = 0, r2 = 4, c2 = 2 |
2 |
Incorrect |
0 ms |
288 KB |
Error - check the range of the parameters of countTreasure() : r1 = 1, c1 = 0, r2 = 9, c2 = 4 |
3 |
Incorrect |
0 ms |
212 KB |
Error - check the range of the parameters of countTreasure() : r1 = 1, c1 = 0, r2 = 14, c2 = 7 |
4 |
Incorrect |
1 ms |
212 KB |
Error - check the range of the parameters of countTreasure() : r1 = 1, c1 = 0, r2 = 15, c2 = 7 |
5 |
Incorrect |
1 ms |
340 KB |
Error - check the range of the parameters of countTreasure() : r1 = 1, c1 = 0, r2 = 54, c2 = 27 |
6 |
Incorrect |
1 ms |
340 KB |
Error - check the range of the parameters of countTreasure() : r1 = 1, c1 = 0, r2 = 65, c2 = 32 |
7 |
Incorrect |
1 ms |
340 KB |
Error - check the range of the parameters of countTreasure() : r1 = 1, c1 = 0, r2 = 76, c2 = 38 |
8 |
Incorrect |
1 ms |
340 KB |
Error - check the range of the parameters of countTreasure() : r1 = 1, c1 = 0, r2 = 87, c2 = 43 |
9 |
Incorrect |
1 ms |
340 KB |
Error - check the range of the parameters of countTreasure() : r1 = 1, c1 = 0, r2 = 98, c2 = 49 |
10 |
Incorrect |
1 ms |
340 KB |
Error - check the range of the parameters of countTreasure() : r1 = 1, c1 = 0, r2 = 99, c2 = 49 |