# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
140434 | silxikys | Treasure (different grader from official contest) (CEOI13_treasure2) | C++14 | 3 ms | 504 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 <bits/stdc++.h>
#include "treasure.h"
using namespace std;
using ll = long long;
const int maxn = 105;
int g[maxn][maxn];
void recurse(int r1, int c1, int r2, int c2) {
int r = countTreasure(r1,c1,r2,c2);
if (r == (r2-r1+1)*(c2-c1+1)) {
//all filled
for (int i = r1; i <= r2; i++) {
for (int j = c1; j <= c2; j++) {
g[i][j] = 1;
}
}
return;
}
else if (r == 0) {
return;
}
else {
if (r1 == r2) {
int m = (c1+c2)/2;
recurse(r1,c1,r2,m);
recurse(r1,m+1,r2,c2);
}
else {
int m = (r1+r2)/2;
recurse(r1,c1,m,c2);
recurse(m+1,c1,r2,c2);
}
}
}
void findTreasure (int N) {
recurse(1,1,N,N);
for (int i = 1; i <= N; i++) {
for (int j = 1; j <= N; j++) {
if (g[i][j] == 1) Report(i,j);
}
}
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |