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<bits/stdc++.h>
#ifdef EVAL
#else
#include"grader.cpp"
#endif
using namespace std;
void construct_network(int H,int W,int K){
if(min(H,W)==1||(H<31&&W<31)){
vector<int>total;
for(int i1=0;i1<H;i1++)
for(int j1=0;j1<W;j1++){
vector<int>v,vv;
for(int i2=0;i2<H;i2++)
for(int j2=0;j2<W;j2++)
if(abs(i1-i2)+abs(j1-j2)==K)vv.push_back(i2*W+j2);
if(vv.empty())continue;
total.push_back(add_and({i1*W+j1,add_or(vv)}));
}
add_or(total);
}else if(K==1){
vector<int>cas,row(H),col(W);
int xor_row,xor_col;
for(int i=0;i<H;i++){
vector<int>v;
for(int j=0;j<W;j++)v.push_back(i*W+j);
row[i]=add_or(v);
}
xor_row=add_xor(row);
for(int j=0;j<W;j++){
vector<int>v;
for(int i=0;i<H;i++)v.push_back(i*W+j);
col[j]=add_or(v);
}
xor_col=add_xor(col);
vector<int>v;
for(int j=1;j<W;j++)
v.push_back(add_and({col[j-1],col[j]}));
cas.push_back(add_and({xor_row,add_or(v)}));
v.clear();
for(int i=1;i<H;i++)
v.push_back(add_and({row[i-1],row[i]}));
cas.push_back(add_and({xor_col,add_or(v)}));
add_or(cas);
}else{
vector<int>total;
for(int i1=0;i1<1;i1++)
for(int j1=0;j1<1;j1++){
vector<int>v,vv;
for(int i2=0;i2<H;i2++)
for(int j2=0;j2<W;j2++)
if(abs(i1-i2)+abs(j1-j2)==K)vv.push_back(i2*W+j2);
if(vv.empty())continue;
total.push_back(add_and({i1*W+j1,add_or(vv)}));
}
add_or(total);
}
}
# | 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... |