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 <iostream>
using namespace std;
const int dx[] = {+1, +1};
const int dy[] = {+1, -1};
void construct_network(int H, int W, int K) {
int sz = H * W, cur = H * W - 1;
vector<int> ask, ksa, is(K + 1, 0), si(K + 1, 0);
vector<int> kek[K + 1], lol[K + 1];
for (int i = 0; i < H; ++i) {
ask.clear();
for (int j = 0; j < W; ++j)
ask.push_back(i * W + j);
add_or(ask);
}
for (int j = 0; j < W; ++j) {
ask.clear();
for (int i = 0; i < H; ++i)
ask.push_back(i * W + j);
add_or(ask);
}
sz = H * W, cur = H * W + H + W - 1;
ask.clear();
for (int i = 0; i < H; ++i) {
ask.push_back(sz + i);
for (int j = 1; i + j < H && j <= K; ++j) {
add_and({sz + i, sz + i + j});
cur++;
kek[j].push_back(cur);
}
}
add_xor(ask);
cur++;
kek[0].push_back(cur);
sz = H * W + H;
ask.clear();
for (int i = 0; i < W; ++i) {
ask.push_back(sz + i);
for (int j = 1; i + j < W && j <= K; ++j) {
add_and({sz + i, sz + i + j});
cur++;
lol[j].push_back(cur);
}
}
add_xor(ask);
cur++;
lol[0].push_back(cur);
for (int i = 0; i <= K; ++i) {
if (kek[i].empty())
add_xor({0, 0});
else
add_or(kek[i]);
cur++;
is[i] = cur;
}
for (int i = 0; i <= K; ++i) {
if (lol[i].empty())
add_xor({0, 0});
else
add_or(lol[i]);
cur++;
si[i] = cur;
}
ask.clear();
for (int i = 0; i <= K; ++i) {
add_and({is[i], si[K - i]});
cur++;
ask.push_back(cur);
}
add_or(ask);
return;
}
# | 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... |