# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
430933 | _fractal | Vision Program (IOI19_vision) | C++14 | 10 ms | 1124 KiB |
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;
if (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);
}
for (int i = 0; i < H - 1; ++i) {
add_and({sz + i, sz + i + 1});
}
sz += H;
for (int i = 0; i < W - 1; ++i) {
add_and({sz + i, sz + i + 1});
}
ask.clear();
for (int i = 0; i < H; ++i)
ask.push_back(H * W + i);
for (int i = 0; i < W; ++i)
ask.push_back(H * W + H + i);
add_xor(ask); //H * W + H + W + H - 1 + W - 1
ask.clear();
for (int i = 0; i < H - 1; ++i)
ask.push_back(H * W + H + W + i);
add_or(ask); //H * W + H + W + H - 1 + W;
ask.clear();
for (int i = 0; i < W - 1; ++i)
ask.push_back(H * W + H + W + H - 1 + i);
add_or(ask); //H * W + H + W + H + W;
add_xor({H * W + H + W + H + W, H * W + H + W + H + W - 1});
add_and({H * W + H + W + H + 1 + W, H * W + H + W + H + W - 1 - 1});
return;
}
for (int i = 0; i < H; ++i) {
for (int j = 0; j < W; ++j) {
for (int k = 0; k <= K; ++k) {
for (int x = 0; x < 2; ++x) {
if (i + dx[x] * k >= H || i + dx[x] * k < 0 ||
j + dy[x] * (K - k) >= W || j + dy[x] * (K - k) < 0)
continue;
ask.push_back(sz);
sz++;
int a = i * W + j;
int b = (i + dx[x] * k) * W + j + dy[x] * (K - k);
add_and({a, b});
}
}
}
}
add_or(ask);
return;
}
Compilation message (stderr)
# | 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... |