# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1064909 | Ahmed57 | Vision Program (IOI19_vision) | C++17 | 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"
using namespace std;
#include "vision.h"
void construct_network(int H, int W, int K){
for(int i = 0;i<H;i++){
vector<int> v;
for(int j = 0;j<W;j++){
v.push_back(i*W+j);
}
int val = add_xor(v);
}
for(int j = 0;j<W;j++){
vector<int> v;
for(int i = 0;i<H;i++){
v.push_back(i*W+j);
}
int val = add_xor(v);
}
int init = H*W;
for(int i = 0;i<H;i++){
vector<int> v;
v.push_back(init+i);
if(i)v.push_back(init+H+W+i-1);
int val = add_xor(v);
}
init = H*W+H;
for(int i = 0;i<W;i++){
vector<int> v;
v.push_back(init+i);
if(i)v.push_back(init+H+W+i-1);
int val = add_xor(v);
}
init = H*W+H+W;
int val = add_not(init);
vector<int> bits;
for(int i = 0;i<15;i++){
bits.push_back(add_and({val,init}));
}
for(int i = 0;i<H+W;i++){
vector<int> nbits;
vector<int> lol = {init+i};
for(int i = 0;i<15;i++){
int val = add_and(lol);
nbits.push_back(add_xor({val,bits[i]}));
lol.push_back(bits[i]);
}
bits=nbits;
}
vector<int> nbits;
for(int i = 0;i<15;i++){
if(K&(1<<i)){
nbits.push_back(bits[i]);
}else nbits.push_back(add_not(bits[i]));
}
int val = add_and(nbits);
}