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;
void construct_network(int H, int W, int K) {
vector<int> left[H * W], right[H * W];
for(int i = 0; i < H; i++) {
for(int j = 0; j < W; j++) {
left[i + j].push_back(i * W + j);
right[W + H - 2 - j - i].push_back(i * W + j);
//cout << "i = " << i << ", j = " << j << ", i + j = " << i + j << "\n";
//cout << "i = " << i << ", j = " << j << ", W + H - 2 - j - i = " << W + H - 2 - j - i << "\n";
}
}
vector<int> left_diag, pref_left_diag;
vector<int> right_diag, pref_right_diag;
for(int i = 0; i < H + W - 1; i++) {
left_diag.push_back(add_or(left[i]));
right_diag.push_back(add_or(right[i]));
if(i == 0) {
pref_left_diag.push_back(left_diag[0]);
pref_right_diag.push_back(right_diag[0]);
}
else {
pref_left_diag.push_back(add_or({pref_left_diag[i - 1], left_diag[i]}));
pref_right_diag.push_back(add_or({pref_right_diag[i - 1], right_diag[i]}));
}
}
vector<int> ans_left, ans_right, ans1_left, ans1_right;
for(int i = K; i < H + W - 1; i++) {
ans_left.push_back(add_and({pref_left_diag[i - K], left_diag[i]}));
ans_right.push_back(add_and({pref_right_diag[i - K], right_diag[i]}));
if(i != K) {
ans1_left.push_back(add_and({pref_left_diag[i - K - 1], left_diag[i]}));
ans1_right.push_back(add_and({pref_right_diag[i - K - 1], right_diag[i]}));
}
}
int res1 = add_and({add_or(ans_left), add_or(ans_right)});
if(K != H + W - 2) {
int res2 = add_and({add_or(ans1_left), add_or(ans1_right)});
add_xor({res1, res2});
}
/*std::vector<int> Ns;
Ns = {0, 1};
int a = add_and(Ns);
Ns = {0, a};
int b = add_or(Ns);
Ns = {0, 1, b};
int c = add_xor(Ns);
add_not(c);*/
}
# | 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... |