#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 + 1, j1 + 1, i2 + 1, j2 + 1);
}
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 + 1, j + 1);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct - N = 5, K = 289, score = 10 |
2 |
Correct |
1 ms |
212 KB |
Output is correct - N = 10, K = 4475, score = 10 |
3 |
Correct |
1 ms |
212 KB |
Output is correct - N = 15, K = 22289, score = 10 |
4 |
Correct |
1 ms |
212 KB |
Output is correct - N = 16, K = 28928, score = 10 |
5 |
Correct |
0 ms |
340 KB |
Output is correct - N = 55, K = 4005289, score = 10 |
6 |
Correct |
1 ms |
340 KB |
Output is correct - N = 66, K = 8305803, score = 10 |
7 |
Correct |
1 ms |
340 KB |
Output is correct - N = 77, K = 15383161, score = 10 |
8 |
Correct |
0 ms |
340 KB |
Output is correct - N = 88, K = 26244416, score = 10 |
9 |
Correct |
1 ms |
340 KB |
Output is correct - N = 99, K = 42032201, score = 10 |
10 |
Correct |
1 ms |
340 KB |
Output is correct - N = 100, K = 43760000, score = 10 |