이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "vision.h"
#include <bits/stdc++.h>
using namespace std;
int IsExist(int H, int W, int K) { // Check whether there exists one of the values >= K
vector<vector<int>> diagL(H + W - 1); // from topleft
vector<vector<int>> diagR(H + W - 1); // from topright
for (int x = 0; x < H; x++) {
for (int y = 0; y < W; y++) {
diagL[x + y].emplace_back(x * W + y);
diagR[x + W - y - 1].emplace_back(x * W + y);
}
}
vector<int> prefL; // diagonal prefix from topleft
vector<int> prefR; // diagonal prefix from topright
vector<int> check; // check for diagonal_distance >= K from either topleft or topright
for (int d = K; d < H + W - 1; d++) {
prefL.insert(end(prefL), begin(diagL[d - K]), end(diagL[d - K]));
prefR.insert(end(prefR), begin(diagR[d - K]), end(diagR[d - K]));
check.emplace_back(add_and({add_or(diagL[d]), add_or(prefL)}));
check.emplace_back(add_and({add_or(diagR[d]), add_or(prefR)}));
}
return add_or(check);
}
void construct_network(int H, int W, int K) {
if (K == H + W - 2) {
IsExist(H, W, K);
} else {
add_and({IsExist(H, W, K), add_not(IsExist(H, W, 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... |