#include "treasure.h"
#include <bits/stdc++.h>
using namespace std;
int n;
bool ans[105][105];
map<array<int, 4>, int> call;
int query(int x1, int y1, int x2, int y2) {
if (call.count({x1, y1, x2, y2})) {
return call[{x1, y1, x2, y2}];
}
return countTreasure(x1, y1, x2, y2);
}
void findTreasure (int N) {
n = N;
// for(int i = 1; i <= n; i++) {
// for(int j = 1; j <= n; j++) {
// if (query(i, j, i, j)) {
// ans[i][j] = true;
// }
// }
// }
//
for(int i = 0; i < n; i++) {
int cnt = query(i+1, 1, i+1, n);
// cout << cnt << "\n";
int curr = 1;
int l = 1, r = n;
while(curr <= cnt) {
r = n;
int rep = 0;
while(l <= r) {
int mid = (l + r) / 2;
int x = query(i+1, 1, i+1, mid);
if (x >= curr) {
rep = mid;
r = mid - 1;
} else {
l = mid + 1;
}
}
curr++;
assert(rep != 0);
// cout << "add " << i << " " << rep << "\n";
ans[i+1][rep] = true;
}
}
for(int i = 1; i <= n; i++) {
for(int j = 1; j <= n; j++) {
if (ans[i][j]) {
Report(i, j);
}
// cerr << ans[i][j] << " ";
}
// cerr << "\n";
}
// int cnt = countTreasure(1, 1, N, N);
// if(cnt > 0) Report(1, 1);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
204 KB |
Output isn't correct - N = 5, K = 949, score = 0 |
2 |
Incorrect |
0 ms |
204 KB |
Output isn't correct - N = 10, K = 14969, score = 0 |
3 |
Incorrect |
0 ms |
204 KB |
Output isn't correct - N = 15, K = 75564, score = 0 |
4 |
Incorrect |
1 ms |
204 KB |
Output isn't correct - N = 16, K = 83988, score = 0 |
5 |
Incorrect |
1 ms |
332 KB |
Output isn't correct - N = 55, K = 20645921, score = 0 |
6 |
Incorrect |
1 ms |
344 KB |
Output isn't correct - N = 66, K = 47198446, score = 0 |
7 |
Incorrect |
1 ms |
332 KB |
Output isn't correct - N = 77, K = 86354274, score = 0 |
8 |
Incorrect |
1 ms |
332 KB |
Output isn't correct - N = 88, K = 188014490, score = 0 |
9 |
Incorrect |
1 ms |
332 KB |
Output isn't correct - N = 99, K = 257542300, score = 0 |
10 |
Incorrect |
1 ms |
332 KB |
Output isn't correct - N = 100, K = 269485170, score = 0 |