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>
void construct_network(int H, int W, int K) {
if (H == 1 || W == 1) {
std::vector<int> idx;
for (int i = 0;i + K < H*W; ++i) {
idx.push_back(add_and({i, i+K}));
}
add_or(idx);
return;
}
if (H * W <= 900) {
std::vector<int> imp;
for (int i = 0;i < H*W; ++i) {
std::vector<int> idx;
for (int j = i+1;j < H*W; ++j) {
int x1 = i / W;
int y1 = i % W;
int x2 = j / W;
int y2 = j % W;
if (std::abs(x1 - x2) + std::abs(y1 - y2) == K) {
idx.push_back(j);
}
}
if (idx.size()) {
imp.push_back(add_and(std::vector<int>{i, (add_or(idx))}));
}
}
add_or(imp);
return;
}
}
# | 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... |