#include "treasure.h"
using namespace std;
const int N = 105;
bool mx[N][N];
static int ask(int l1, int c1, int l2, int c2) {
return countTreasure(l1, c1, l2, c2); }
static void divide(int l1, int c1, int l2, int c2, int count) {
if (count == (l2 - l1 + 1) * (c2 - c1 + 1)) {
for (int i = l1; i <= l2; ++i)
for (int j = c1; j <= c2; ++j)
mx[i][j] = 1;
return; }
if (count == 0)
return;
if (l2 - l1 >= c2 - c1) {
int mid = (l1 + l2) / 2;
int half = ask(l1, c1, mid, c2);
divide(l1, c1, mid, c2, half);
divide(mid + 1, c1, l2, c2, count - half); }
else {
int mid = (c1 + c2) / 2;
int half = ask(l1, c1, l2, mid);
divide(l1, c1, l2, mid, half);
divide(l1, mid + 1, l2, c2, count - half); } }
void findTreasure(int n){
divide(1, 1, n, n, ask(1, 1, n, n));
for (int i = 1; i <= n; ++i)
for (int j = 1; j <= n; ++j)
if (mx[i][j])
Report(i, j); }
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
2 ms |
384 KB |
Output is partially correct - N = 5, K = 480, score = 8 |
2 |
Partially correct |
2 ms |
384 KB |
Output is partially correct - N = 10, K = 6428, score = 4 |
3 |
Correct |
2 ms |
384 KB |
Output is correct - N = 15, K = 12286, score = 10 |
4 |
Correct |
2 ms |
384 KB |
Output is correct - N = 16, K = 16525, score = 10 |
5 |
Partially correct |
2 ms |
384 KB |
Output is partially correct - N = 55, K = 6566863, score = 4 |
6 |
Partially correct |
2 ms |
384 KB |
Output is partially correct - N = 66, K = 13820786, score = 4 |
7 |
Correct |
2 ms |
384 KB |
Output is correct - N = 77, K = 5400779, score = 10 |
8 |
Correct |
2 ms |
384 KB |
Output is correct - N = 88, K = 7256189, score = 10 |
9 |
Partially correct |
2 ms |
432 KB |
Output is partially correct - N = 99, K = 69772754, score = 4 |
10 |
Partially correct |
2 ms |
384 KB |
Output is partially correct - N = 100, K = 73299313, score = 4 |