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"
#define MAXN 100009
#define INF 1000000007
#define mp(x,y) make_pair(x,y)
#define all(v) v.begin(),v.end()
#define pb(x) push_back(x)
#define wr cout<<"----------------"<<endl;
#define ppb() pop_back()
#define tr(ii,c) for(__typeof((c).begin()) ii=(c).begin();ii!=(c).end();ii++)
#define ff first
#define ss second
#define my_little_dodge 46
#define debug(x) cerr<< #x <<" = "<< x<<endl;
#define debug2(x,y) cerr<< #x <<" = "<< x<<" "<< #y <<" = "<< y<<endl;
using namespace std;
int _add(int x,int y){
vector<int>v;
v.pb(x);v.pb(y);
return add_and(v);
}
int _or(int x,int y){
vector<int>v;
v.pb(x);v.pb(y);
return add_or(v);
}
int _xor(int x,int y){
vector<int>v;
v.pb(x);v.pb(y);
return add_xor(v);
}
int n,m;
const int N=202;
vector<int>adj[2*N];
int res_or[2*N],res_xor[2*N];
int solve(int t,int dis){
if(!t){
for(int i=0;i<n;i++)
for(int j=0;j<m;j++)
adj[i+j].pb(i*m+j);
}
else{
for(int i=0;i<n;i++)
for(int j=0;j<m;j++)
adj[i-j+N].pb(i*m+j);
}
vector<int>ans;
int l=-1,r;
for(int i=0;i<2*N;i++){
if(adj[i].size()){
if(l==-1)
l=i;
r=i;
res_or[i]=add_or(adj[i]);
res_xor[i]=add_xor(adj[i]);
}
adj[i].clear();
}
for(int i=l;i<=r;i++){
vector<int>tmp;
for(int j=max(l,i-dis);j<=min(r,i+dis);j++)
if(i!=j)
tmp.pb(res_or[j]);
tmp.pb(add_not(res_or[i]));
tmp.pb(_xor(res_or[i],res_xor[i]));
ans.pb(add_not(add_or(tmp)));
}
return add_or(ans);
}
void construct_network(int H, int W, int K) {n=H;m=W;
_xor(_or(solve(0,K),solve(1,K)),_or(solve(0,K-1),solve(1,K-1)));
}
# | 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... |