# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
39395 | pce913 | Treasure (different grader from official contest) (CEOI13_treasure2) | C++14 | 0 ms | 2724 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>
#include<iostream>
using namespace std;
int M[405][405];
int n;
const int BOUND = 128;
void find_ans(int cx,int cy,int len){
if (cx > n || cy > n)
return;
if (len == 1){
M[cx][cy] = countTreasure(cx, cy, cx, cy) == 1;
return;
}
//cout << cx << " " << cy << " " << len << endl;
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 <= min(n, cx + len - 1); i++){
for (int j = cy; j <= min(n, cy + len - 1); j++){
M[i][j] = 1;
}
}
}
}
void findTreasure(int N) {
n = N;
if (n <= 10){
for (int i = 1; i <= N; ++i)
for (int j = 1; j <= N; ++j)
M[i][j] = countTreasure(i, j, i, j);
for (int i = 1; i <= N; ++i)
for (int j = 1; j <= N; ++j)
if (M[i][j])
Report(i, j);
return;
}
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... |