# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1026790 | Zicrus | Vision Program (IOI19_vision) | C++17 | 7 ms | 1116 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 <bits/stdc++.h>
#include "vision.h"
using namespace std;
typedef long long ll;
vector<int> distIdVec(vector<int> xId, int W, int K) {
int sameX = add_xor(xId);
vector<int> distXId;
for (int xOffset = 0; xOffset <= K && xOffset < W; xOffset++) {
vector<int> offsetId;
for (int xPos = 0; xPos < W - xOffset; xPos++) {
offsetId.push_back(add_and({xId[xPos], xOffset == 0 ? sameX : xId[xPos + xOffset]}));
}
distXId.push_back(add_or(offsetId));
}
return distXId;
}
void construct_network(int H, int W, int K) {
if ((H <= 30 && W <= 30) || K == 1) {
vector<int> yId(H);
for (int i = 0; i < H; i++) {
vector<int> r;
for (int j = 0; j < W; j++) {
r.push_back(W * i + j);
}
yId[i] = add_or(r);
}
vector<int> xId(W);
for (int i = 0; i < W; i++) {
vector<int> c;
for (int j = 0; j < H; j++) {
c.push_back(W * j + i);
}
xId[i] = add_or(c);
}
vector<int> distXId = distIdVec(xId, W, K);
vector<int> distYId = distIdVec(yId, H, K);
vector<int> kAtXPosId;
for (int x = 0; x <= K && x < distXId.size(); x++) {
if (K-x >= distYId.size()) continue;
kAtXPosId.push_back(add_and({distXId[x], distYId[K-x]}));
}
add_or(kAtXPosId);
return;
}
vector<int> s;
ll x = min(W-1, K);
ll y = K - x;
while (x >= 0 && y < H) {
s.push_back(W * y + x);
x--; y++;
}
add_or(s);
}
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... |