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>
using namespace std;
void construct_network(int H, int W, int K) {
vector<int>h,w,v;
int h_xor,w_xor;
for(int i=0;i<H;i++){
vector<int>t;
for(int j=0;j<W;j++){
t.push_back(W*i+j);
}
h.push_back(add_or(t));
}
for(int i=0;i<W;i++){
vector<int>t;
for(int j=0;j<H;j++){
t.push_back(W*j+i);
}
w.push_back(add_or(t));
}
h_xor=add_xor(h);
w_xor=add_xor(w);
for(int i=0;i+K<W;i++){
v.push_back(add_and({h_xor,w[i],w[i+K]}));
}
for(int i=0;i+K<H;i++){
v.push_back(add_and({w_xor,h[i],h[i+K]}));
}
for(int i=1;i<K;i++){
if(H<=i||W<=K-i)continue;
vector<int>tmpvec;
int p,q;
p=i;
q=K-i;
if(p>=q){
for(int j=0;j+p<H;j++){
tmpvec.push_back(add_and({h[j],h[j+p]}));
}
int t=add_or(tmpvec);
for(int j=0;j+q<W;j++){
v.push_back(add_and({t,w[j],w[j+q]}));
}
}
else{
for(int j=0;j+q<W;j++){
tmpvec.push_back(add_and({w[j],w[j+q]}));
}
int t=add_or(tmpvec);
for(int j=0;j+p<H;j++){
v.push_back(add_and({t,h[j],h[j+p]}));
}
}
}
add_xor(v);
}
# | 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... |