# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
145453 | kingpig9 | Vision Program (IOI19_vision) | C++14 | 0 ms | 0 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 "vision.h"
using namespace std;
const int MAXN = 410;
int N, M, K;
int ncoord, npair;
vector<int> xtoy[MAXN], _ytox[MAXN], *ytox = _ytox + (M - 1);
int xmin, xmax, ymin, ymax;
//position of x, y in the grid
//precondition: y is in xtoy[x]
int getgrid (int x, int y) {
if (x % 2 != y % 2) {
assert(!"x and y have different parity");
}
int i = (x + y) / 2, j = (x - y) / 2;
assert(0 <= i && i < N);
assert(0 <= j && j < M);
return M * i + j;
}
int getcoord (int nncoord = 0, int nnpair = 0, int offset = 0) {
return N*M + nncoord * ncoord + nnpair * npair + offset;
}
int getindx (int mn, int x) {
return mn + x;
}