# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
94986 | popovicirobert | Treasure (different grader from official contest) (CEOI13_treasure2) | C++14 | 2 ms | 376 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;
const int MAXN = 100;
bool mat[MAXN + 1][MAXN + 1];
int cnt_c[MAXN + 1], cnt_l[MAXN + 1];
void findTreasure (int n) {
int i, j;
int last = countTreasure((n + 1) / 2 + 1, 1, n, n);
for(i = (n + 1) / 2; i >= 1; i--) {
cnt_l[i] = countTreasure(i, 1, n, n) - last;
last += cnt_l[i];
}
last = countTreasure(1, 1, (n + 1) / 2, n);
for(i = (n + 1) / 2 + 1; i <= n; i++) {
cnt_l[i] = countTreasure(1, 1, i, n) - last;
last += cnt_l[i];
}
int sum_l = 0;
for(i = 1; i <= n; i++) {
sum_l += cnt_l[i];
int cnt = 0, tot = 0;
for(j = 1; j < (n + 1) / 2; j++) {
int cur = countTreasure(1, j + 1, i, n);
cnt += cnt_c[j];
if(sum_l - cur - cnt > 0) {
mat[i][j] = 1;
cnt++;
tot++;
}
}
cnt = 0;
for(j = n; j > (n + 1) / 2; j--) {
int cur = countTreasure(1, 1, i, j - 1);
cnt += cnt_c[j];
if(sum_l - cur - cnt > 0) {
mat[i][j] = 1;
cnt++;
tot++;
}
}
mat[i][(n + 1) / 2] = cnt_l[i] - tot;
for(j = 1; j <= n; j++) {
cnt_c[j] += mat[i][j];
}
}
for(i = 1; i <= n; i++) {
for(j = 1; j <= n; j++) {
if(mat[i][j]) {
Report(i, j);
}
}
}
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |