# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
102395 | Milki | Treasure (different grader from official contest) (CEOI13_treasure2) | C++14 | 3 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 <bits/stdc++.h>
#include "treasure.h"
using namespace std;
#define FOR(i, a, b) for(int i = a; i < b; ++i)
#define REP(i, n) FOR(i, 0, n)
#define _ << " " <<
#define sz(x) ((int) x.size())
#define pb(x) push_back(x)
#define TRACE(x) cerr << #x << " = " << x << endl
typedef long long ll;
typedef pair<ll, ll> point;
const int MAXN = 105;
int pref[MAXN][MAXN];
int sum;
void findTreasure(int n){
int mid = (n + 1) / 2;
for(int i = n; i > 0; --i) for(int j = n; j > 0; --j) {
if(i >= mid && j >= mid) pref[i][j] = countTreasure(1, 1, i, j);
else if(i >= mid && j <= mid) pref[i][j] = pref[i][n] - countTreasure(1, j + 1, i, n);
else if(i <= mid && j >= mid) pref[i][j] = pref[n][j] - countTreasure(i + 1, 1, n, j);
else pref[i][j] = pref[n][n] - countTreasure(i + 1, j + 1, n, n) - pref[i][n] - pref[n][j];
}
FOR(i, 1, n + 1) FOR(j, 1, n + 1)
if(pref[i][j] - pref[i - 1][j] - pref[i][j - 1] + pref[i - 1][j - 1]) Report(i, j);
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |