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;
#define n(i, j) ((i)*W + (j))
#define ALL(x) x.begin(), x.end()
void construct_network(int H, int W, int K) {
vector <int> r(H), c(W), N, R0, C0;
for (int i=0; i<H; i++) {
vector <int> list;
for (int j=0; j<W; j++) {
list.push_back(n(i, j));
}
R0.push_back(r[i] = add_xor(list));
}
for (int j=0; j<W; j++) {
vector <int> list;
for (int i=0; i<H; i++) {
list.push_back(n(i, j));
}
C0.push_back(c[j] = add_xor(list));
}
vector <int> distR(K+1), distC(K+1);
distR[0] = add_not(add_or(R0));
distC[0] = add_not(add_or(C0));
for (int i=1; i<=K; i++) {
vector <int> list;
for (int j=0; j<H-i; j++) {
list.push_back(add_and({r[j], r[j+i]}));
}
if (list.empty()) {
distC[i] = -1;
continue;
}
distR[i] = add_or(list);
}
for (int i=1; i<=K; i++) {
vector <int> list;
for (int j=0; j<W-i; j++) {
list.push_back(add_and({c[j], c[j+i]}));
}
if (list.empty()) {
distC[i] = -1;
continue;
}
distC[i] = add_or(list);
}
for (int i=0; i<=K; i++) {
if (distR[i] == -1 || distC[K-i] == -1) {
continue;
}
N.push_back(add_and({distR[i], distC[K-i]}));
}
add_or(N);
}
# | 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... |