# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
78341 | win11905 | Treasure (different grader from official contest) (CEOI13_treasure2) | C++11 | 3 ms | 648 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 recur(int sz, int l, int r) {
if(l == r) return void (szrow[l] = sz);
int m = l + r >> 1;
int cnt = countTreasure(l, 1, m, N);
recur(cnt, l, m), recur(sz - cnt, m+1, r);
}
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);
recur(cnt, 1, N);
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... |