이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "vision.h"
void construct_network(int H, int W, int K) {
std::vector <int> res, res1;
if ((H == 1) || (W == 1)) {
for (int x1 = 0; x1 < H; ++x1)
for (int y1 = 0; y1 < W; ++y1)
for (int x2 = 0; x2 < H; ++x2)
for (int y2 = 0; y2 < W; ++y2) {
if ((abs(x1 - x2) + abs(y1 - y2)) != K)
continue;
add_and({x1 * W + y1, x2 * W + y2});
res.push_back(H * W + (int)(res.size()));
}
add_or(res);
} else {
int cnt = 0;
for (int x1 = 0; x1 < H; ++x1)
for (int y1 = 0; y1 < W; ++y1) {
std::vector <int> cur;
for (int x2 = 0; x2 < H; ++x2)
for (int y2 = 0; y2 < W; ++y2) {
if ((abs(x1 - x2) + abs(y1 - y2)) != K)
continue;
cur.push_back(x2 * W + y2);
}
if (cur.empty())
continue;
add_or(cur);
res.push_back(H * W + cnt);
++cnt;
add_and({x1 * W + y1, res.back()});
res1.push_back(H * W + cnt);
++cnt;
}
add_or(res1);
}
}
# | 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... |