# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
259932 | Sorting | Treasure (different grader from official contest) (CEOI13_treasure2) | C++17 | 1 ms | 512 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 k_N = 100 + 3;
int n;
int sum[2][2][k_N][k_N];
int ans[k_N][k_N];
void findTreasure(int _n){
n = _n;
int a = n / 2 + n % 2, b = n - a;
for(int i = 0; i < 2; ++i){
for(int j = 0; j < 2; ++j){
int x1, x2, y1, y2;
int r, c;
int xd, yd;
if(i == 0) x1 = a, x2 = n, r = 1;
else x1 = 1, x2 = a + 1, r = n;
if(j == 0) y1 = a, y2 = n, c = 1;
else y1 = 1, y2 = a + 1, c = n;
for(int x = x1; x <= x2; ++x)
for(int y = y1; y <= y2; ++y)
sum[i][j][x][y] = countTreasure(min(x, r), min(y, c), max(x, r), max(y, c));
if(i == 0) x1 = a + 1, x2 = n, xd = -1;
else x1 = 1, x2 = a, xd = 1;
if(j == 0) y1 = a + 1, y2 = n, yd = -1;
else y1 = 1, y2 = a, yd = 1;
for(int x = x1; x <= x2; ++x)
for(int y = y1; y <= y2; ++y)
ans[x][y] = sum[i][j][x][y] - sum[i][j][x + xd][y] - sum[i][j][x][y + yd] + sum[i][j][x + xd][y + yd];
}
}
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... |