이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#include "vision.h"
using namespace std;
void construct_network(int H, int W, int K) {
const auto cell = [&](int x, int y) {
y -= W - 1;
if ((x - y) % 2 != 0) return -1;
const int i = (x + y) / 2;
const int j = (x - y) / 2;
if (0 <= i and i < H and 0 <= j and j < W) {
return i * W + j;
} else {
return -1;
}
};
const int N = H + W - 1;
vector<int> row(N), col(N);
for (int i = 0; i < N; ++i) {
vector<int> x, y;
for (int j = 0; j < N; ++j) {
const int a = cell(i, j);
const int b = cell(j, i);
if (a != -1) x.push_back(a);
if (b != -1) y.push_back(b);
}
row[i] = add_or(x);
col[i] = add_or(y);
}
const auto solve = [&](const int thres) {
vector<int> x, y;
for (int k = thres; k <= N; ++k) {
vector<int> a, b;
for (int i = 0; i < k - thres; ++i) {
a.push_back(row[i]);
b.push_back(col[i]);
}
for (int i = k; i < N; ++i) {
a.push_back(row[i]);
b.push_back(col[i]);
}
x.push_back(add_or(a));
y.push_back(add_or(b));
}
return add_not(add_or({add_and(x), add_and(y)}));
};
if (K + 1 == N) add_not(solve(K));
else add_xor({solve(K), 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... |