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 <bits/stdc++.h>
#include "vision.h"
using namespace std;
const int MAX_N = 405;
int H, W;
vector <int> tl[MAX_N], tr[MAX_N];
vector <int> tL, tR, qsL, qsR;
vector <int> ans;
void init(int h, int w) {
H = h, W = w;
for(int i = 0; i < H + W - 1; i++) {
tl[i].clear();
tr[i].clear();
}
}
int id(int x, int y) {
return x * W + y;
}
int solve(int K) {
ans.clear();
for(int i = 0; i + K < H + W - 1; i++) {
ans.push_back(add_and({qsL[i], tL[i + K]}));
ans.push_back(add_and({qsR[i], tR[i + K]}));
}
return add_or(ans);
}
void construct_network(int h, int w, int K) {
init(h, w);
for(int i = 0; i < H; i++) {
for(int j = 0; j < W; j++) {
tl[i + j].push_back(id(i, j));
tr[H - 1 + j - i].push_back(id(i, j));
}
}
for(int i = 0; i < H + W - 1; i++) {
tL.push_back(add_or(tl[i]));
tR.push_back(add_or(tr[i]));
qsL.push_back(add_or(tL));
qsR.push_back(add_or(tR));
}
if(K == H + W - 2) {
solve(K);
}
else {
add_and({solve(K), add_not(solve(K + 1))});
}
}
# | 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... |