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 "vision.h"
#include <bits/stdc++.h>
using namespace std;
int h, w;
int withdist(int x, int y, int k) // mame aspon jeden ktory ma vzdialenost najviac k od policka x
{
vector<int> v;
for (int xi = 0; xi < h; xi++) for (int yi = 0; yi < w; yi++) if (abs(x - xi) + abs(y - yi) <= k) v.push_back(xi * w + yi);
return add_or(v);
}
int more(int k) // je to aspon k
{
vector<int> a; // tie andy tych regionov
for (int i = 0; i + k <= h + w - 2; i++)
{
vector<int> o1 = { withdist(0, 0, i), withdist(h - 1, w - 1, h - 1 + w - 1 - (i + k)) };
a.push_back(add_and(o1));
vector<int> o2 = { withdist(0, w - 1, i), withdist(h - 1, 0, h - 1 + w - 1 - (i + k)) };
a.push_back(add_and(o2));
}
return add_or(a);
}
void construct_network(int H, int W, int k)
{
h = H, w = W;
if (k >= h + w - 2) more(k);
else add_xor({ more(k), more(k + 1) });
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |