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 "grader.cpp"
#include <bits/stdc++.h>
using namespace std;
int h, w, k;
int get(int x, int y) {
return x * w + y;
}
bool check(int x, int y) {
return (0 <= x && x < h && 0 <= y && y < w);
}
void construct_network(int H, int W, int K) {
vector <int> asd[2][1000];
h = H; w = W; k = K;
vector <int> v, v1;
for (int i = 0; i < h; i++) {
for (int j = 0; j < w; j++) {
asd[0][i + j].push_back(get(i, j));
asd[1][w - 1 + i - j].push_back(get(i, j));
}
}
vector <int> c[2];
for (int i = 0; i < h + w - 1; i++) {
c[0].push_back(add_or(asd[0][i]));
c[1].push_back(add_or(asd[1][i]));
}
for (int i = 0; i < h + w - 1; i++) {
vector <int> cur;
for (int j = i - k - 1; j >= 0; j--) {
cur.push_back(c[0][j]);
}
for (int j = i + k + 1; j < h + w - 1; j++) {
cur.push_back(c[0][j]);
}
if (!cur.empty())
v.push_back(add_and({add_or(cur), c[0][i]}));
cur.clear();
for (int j = i - k - 1; j >= 0; j--) {
cur.push_back(c[1][j]);
}
for (int j = i + k + 1; j < h + w - 1; j++) {
cur.push_back(c[1][j]);
}
if (!cur.empty())
v.push_back(add_and({add_or(cur), c[1][i]}));
if (i - k >= 0) {
v1.push_back(add_and({c[0][i - k], c[0][i]}));
v1.push_back(add_and({c[1][i - k], c[1][i]}));
}
}
int ans1 = -1;
if (!v.empty()) ans1 = add_not(add_or(v));
int as = add_or(v1);
if (ans1 != -1) {
add_and({as, ans1});
}
}
# | 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... |