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"
using namespace std;
typedef vector<int> vi;
#define sz(x) (int)(x).size()
int h, w, k;
int calc_pos(int x, int y) {
return y * w + x;
}
void construct_network(int H, int W, int K) {
h = H;
w = W;
k = K;
vi all(0);
for (int x = 0; x < W; ++x) {
for (int y = 0; y < H; ++y) {
vi neigs;
for (int dx = -K; dx < K; ++dx) {
int nx = x + dx, ny = y + min(abs(dx - K), abs(dx + K));
if (0 <= nx && nx < W && 0 <= ny && ny < H)
neigs.push_back(calc_pos(nx, ny));
}
if (sz(neigs) > 0)
all.push_back(add_and({calc_pos(x, y), add_or(neigs)}));
}
}
if (sz(all) == 0) {
for (int x = 0; x < W; ++x) {
for (int y = 0; y < H; ++y) {
all.push_back(calc_pos(x, y));
}
}
add_not(add_or(all));
} else {
add_or(all);
};
}
# | 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... |