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,k;
bool bounds(int y, int x) {
if(y >= 0 && x >= 0 && y < h && x < w) return true;
return false;
}
void construct_network(int H, int W, int K) {
h = H; w = W; k = K;
int index = H*W;
vector<int> and_indices;
for(int y = 0; y < H; y++) {
for(int x = 0; x < W; x++) {
vector<int> P;
for(int i = 0; i <= K; i++) {
int fdir = i;
int sdir = K-i;
if(bounds(y+fdir, x+sdir)) P.push_back((y+fdir)*W + x+sdir);
if(bounds(y+fdir, x-sdir)) P.push_back((y+fdir)*W + x-sdir);
if(bounds(y-fdir, x+sdir)) P.push_back((y-fdir)*W + x+sdir);
if(bounds(y-fdir, x-sdir)) P.push_back((y-fdir)*W + x-sdir);
}
add_or(P);
index++;
and_indices.push_back(index);
add_and({y*W + x, index-1});
index++;
}
}
add_or(and_indices);
}
# | 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... |