# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
39391 | pce913 | Treasure (different grader from official contest) (CEOI13_treasure2) | C++14 | 0 ms | 1820 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "treasure.h"
#include<algorithm>
using namespace std;
int M[405][405];
int n;
const int BOUND = 128;
void find_ans(int cx,int cy,int len){
if (len == 1){
M[cx][cy] = countTreasure(cx, cy, cx, cy) == 1;
return;
}
int sum = countTreasure(cx, cy, min(n, cx + len - 1), min(n, cy + len - 1));
if (sum != min(len,n-cx+1)*min(len,n-cy+1)){
find_ans(cx, cy, len / 2);
find_ans(cx + len/2, cy, len / 2);
find_ans(cx, cy + len / 2, len / 2);
find_ans(cx + len / 2, cy + len / 2, len / 2);
}
else{
for (int i = cx; i <= cx + len - 1; i++){
for (int j = cy; j <= cy + len - 1; j++){
M[i][j] = 1;
}
}
}
}
void findTreasure(int N) {
n = N;
//total = countTreasure(1, 1, N, N);
find_ans(1, 1, BOUND);
for (int i = 1; i <= n; i++){
for (int j = 1; j <= n; j++){
if (M[i][j] == 1)
Report(i, j);
}
}
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |