# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
422818 | SSRS | Vision Program (IOI19_vision) | C++14 | 0 ms | 0 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;
void construct_network(int H, int W, int K){
assert(K == 1);
int mx = H + W - 1;
vector<vector<int>> id1(mx), id2(mx);
for (int i = 0; i < H; i++){
for (int j = 0; j < W; j++){
id1[i + j].push_back(i * W + j);
id2[i - j + (W - 1)].push_back(i * W + j);
}
}
vector<int> a(mx), b(mx);
for (int i = 0; i < mx; i++){
a[i] = add_or(id1[i]);
b[i] = add_or(id2[i]);
}
vector<int> a2(mx - 1), b2(mx - 1);
for (int i = 0; i < mx - 1; i++){
a2[i] = add_and(a[i], a[i + 1]);
b2[i] = add_and(b[i], b[i + 1]);
}
int X = add_or(a2);
int Y = add_or(b2);
add_and(X, Y);
}