#include <bits/stdc++.h>
#include "treasure.h"
using namespace std;
void findTreasure(int N) {
int a[N+1][N+1] {};
for(int i = N + 1; --i; ) for(int j = N + 1; --j; ) {
int b[4] = {i * j, j * (N - i), i * (N - j), (N - i) * (N - j)}, k = max_element(b, b + 4) - b;
if(k == 0) a[i][j] = countTreasure(1, 1, i, j);
if(k == 1) a[i][j] = a[N][j] - countTreasure(i + 1, 1, N, j);
if(k == 2) a[i][j] = a[i][N] - countTreasure(1, j + 1, i, N);
if(k == 3) a[i][j] = a[N][N] + countTreasure(i + 1, j + 1, N, N) - a[i][N] - a[N][j];
}
for(int i = N + 1; --i; ) for(int j = N + 1; --j; )
if(a[i][j] - a[i-1][j] - a[i][j-1] + a[i-1][j-1]) Report(i, j);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Error - no treasure at (r, c) : r = 3, c = 3 |
2 |
Incorrect |
1 ms |
212 KB |
Error - no treasure at (r, c) : r = 5, c = 4 |
3 |
Incorrect |
1 ms |
304 KB |
Error - no treasure at (r, c) : r = 8, c = 4 |
4 |
Incorrect |
1 ms |
212 KB |
Error - no treasure at (r, c) : r = 8, c = 8 |
5 |
Incorrect |
0 ms |
300 KB |
Error - no treasure at (r, c) : r = 28, c = 28 |
6 |
Incorrect |
1 ms |
308 KB |
Error - no treasure at (r, c) : r = 33, c = 31 |
7 |
Incorrect |
1 ms |
340 KB |
Error - no treasure at (r, c) : r = 39, c = 9 |
8 |
Incorrect |
1 ms |
340 KB |
Error - no treasure at (r, c) : r = 44, c = 11 |
9 |
Incorrect |
1 ms |
340 KB |
Error - no treasure at (r, c) : r = 50, c = 50 |
10 |
Incorrect |
1 ms |
340 KB |
Error - no treasure at (r, c) : r = 50, c = 47 |