# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
78342 | win11905 | Treasure (different grader from official contest) (CEOI13_treasure2) | C++11 | 2 ms | 688 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 <bits/stdc++.h>
using namespace std;
int N;
int szrow[105];
bool ans[105][105];
void rec(int sz, int R, int l, int r) {
if(l == r) {
if(sz) ans[R][l] = true;
return;
}
int m = l + r >> 1;
int cnt = countTreasure(R, l, R, m);
rec(cnt, R, l, m), rec(sz - cnt, R, m+1, r);
}
void findTreasure (int N) {
::N = N;
int cnt = countTreasure(1, 1, N, N);
int m = N >> 1;
for(int i = N-1; i >= m; --i) {
int val = countTreasure(1, 1, i, N);
szrow[i+1] = cnt - val;
cnt = val;
}
cnt = countTreasure(1, 1, N, N);
for(int i = 2; i <= m+1; ++i) {
int val = countTreasure(i, 1, N, N);
szrow[i-1] = cnt - val;
cnt = val;
}
for(int i = 1; i <= N; ++i) rec(szrow[i], i, 1, N);
for(int i = 1; i <= N; ++i) for(int j = 1; j <= N; ++j) if(ans[i][j]) Report(i, j);
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |