# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
86164 | faceless | Treasure (different grader from official contest) (CEOI13_treasure2) | C++14 | 295 ms | 263168 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"
bool c[120][120];
int dp[120][120];
int find (int idx, int L, int R, int cnt = -1) {
if (cnt == -1) {
cnt = countTreasure (1, L, idx, R - 1) - dp[idx - 1][R - 1] + dp[idx - 1][L - 1];
}
if (cnt == (R - L)) {
for (int j = L; j < R; j++) {
c[idx][j] = 1;
}
return cnt;
}
if (cnt == 0)
return cnt;
int mid = (L + R) >> 1;
int x = find (idx, mid, R);
find (idx, L, mid, cnt - x);
return cnt;
}
void findTreasure (int N) {
for (int i = 1; i <= N; i++) {
find (i, 1, N + 1);
for (int j = 1; j <= N; j++) {
dp[i][j] = dp[i - 1][j] + dp[i][j - 1] - dp[i - 1][j - 1];
}
}
for (int i = 1; i <= N; i++)
for (int j = 1; j <= N; j++)
if (c[i][j])
Report (i, j);
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |