# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
430457 | p_square | 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 <vision.h>
using namespace std;
#define mp make_pair
#define fi first
#define se second
int h;
int w;
int k;
int cnum(int i, int j)
{
return i*w + j;
}
void opt(vector <int> qry)
{
for(int i = 0; i<qry.size(); i++)
{
cerr<<qry[i]<<" ";
}
}
void construct_network(int H, int W, int K)
{
h = H;
w = W;
k = K;
int row, col, reply, NWd = h*w, NEd = h*w+h+w-1, cr1be, cr1en, cr1;
vector <int> qry;
for(int diag = 0; diag<h+w-1; diag++)
{
qry.clear();
for(row = 0; row<h; row++)
{
col = diag - row;
if(col >= 0 && col < w)
{
qry.push_back(cnum(row, col));
}
}
assert(!qry.empty());
reply = add_xor(qry);
}
for(int diag = 0; diag<h+w-1; diag++)
{
qry.clear();
for(row = 0; row<h; row++)
{
col = w + row - diag - 1;
if(col >= 0 && col < w)
{
cerr<<row<<" "<<col<<endl;
qry.push_back(cnum(row, col));
}
}
assert(!qry.empty());
reply = add_xor(qry);
}
cr1be = reply+1;
for(int i = 0; i<h+w-k-1; i++)
{
reply = add_and({NWd+i, NWd+i+k});
}
for(int i = 0; i<h+w-k-1; i++)
{
reply = add_and({NEd+i, NEd+i+k});
}
cr1en = reply;
qry.clear();
for(int i = cr1be; i<=cr1en; i++)
{
qry.push_back(i);
}
assert(!qry.empty());
cr1 = add_or(qry);
}