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;
#define x first
#define y second
using vi = vector<int>;
using ll = long long;
using vii = vector<vi>;
using pi = pair<int, int>;
int j = 0;
int h, w, k;
int con(pi a) {
return a.x * w + a.y;
}
pi con(int a) {
return {a / w, a % w};
}
int valid(pi a) {
return int(0 <= a.x and a.x < h and 0 <= a.y and a.y < w);
}
int valid(int a) {
return valid(con(a));
}
void findKit(int i, vi &kit) {
pi prad = con(i);
pi c = prad;
c.y += k;
if (valid(c)) kit.emplace_back(con(c));
for (;;)
{
c.y--;
c.x++;
if (valid(c))
kit.emplace_back(con(c));
if (c.y == prad.y) break;
}
for (;;)
{
c.y--;
c.x--;
if (valid(c))
kit.emplace_back(con(c));
if (c.x - 1 == prad.x) break;
}
}
void construct_network(int H, int W, int K) {
h = H;
w = W;
k = K;
vi andai;
for (int i = 0; i < H * W; ++i)
{
vi kit;
findKit(i, kit);
if (kit.empty()) continue;
int n = add_or(kit);
int d = add_and({i});
andai.emplace_back(add_and({d, n}));
}
add_or(andai);
// std::vector<int> Ns;
// Ns = {0, 1};
// int a = add_and(Ns);
// Ns = {0, a};
// int b = add_or(Ns);
// Ns = {0, 1, b};
// int c = add_xor(Ns);
// add_not(c);
}
# | 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... |