#include "treasure.h"
int pref[101][101];
void findTreasure(int N) {
pref[N][N] = countTreasure(1, 1, N, N);
for (int i = 1; i <= N; i++) for (int j = 1; j <= N; j++) {
if (i == N && j == N) continue;
if (1 + N * N - i * j < 3 + 3 * N * N - (N - i) * (N - j) - N * (N - i) - N * (N - j))
pref[i][j] = countTreasure(1, 1, i, j);
else
pref[i][j] = pref[N][N] + countTreasure(i + 1, j + 1, N, N) - countTreasure(i + 1, 1, N, N) - countTreasure(1, j + 1, N, N);
}
for (int i = N; i; i--) for (int j = N; j; j--) {
pref[i][j] -= pref[i - 1][j] + pref[i][j - 1] - pref[i - 1][j - 1];
if (pref[i][j]) Report(i, j);
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
0 ms |
256 KB |
Output is partially correct - N = 5, K = 422, score = 8 |
2 |
Partially correct |
0 ms |
384 KB |
Output is partially correct - N = 10, K = 6887, score = 4 |
3 |
Partially correct |
0 ms |
384 KB |
Output is partially correct - N = 15, K = 35127, score = 4 |
4 |
Partially correct |
0 ms |
384 KB |
Output is partially correct - N = 16, K = 45546, score = 4 |
5 |
Partially correct |
0 ms |
384 KB |
Output is partially correct - N = 55, K = 6441697, score = 4 |
6 |
Partially correct |
0 ms |
384 KB |
Output is partially correct - N = 66, K = 13371371, score = 4 |
7 |
Partially correct |
0 ms |
384 KB |
Output is partially correct - N = 77, K = 24789092, score = 4 |
8 |
Partially correct |
0 ms |
384 KB |
Output is partially correct - N = 88, K = 42313086, score = 4 |
9 |
Partially correct |
1 ms |
384 KB |
Output is partially correct - N = 99, K = 67804878, score = 4 |
10 |
Partially correct |
0 ms |
384 KB |
Output is partially correct - N = 100, K = 70589852, score = 4 |