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 sz(x) ll(x.size())
#define all(x) x.begin(),x.end()
#define pb push_back
#define ff first
#define ss second
using namespace std;
typedef long long ll;
typedef pair<ll,ll> ii;
const ll MAX=1e6;
int n, m, k;
vector<int>c,z,f,q, ans;
void looks(int dist_c, int dist_f){
int aux=dist_c;
int a=1, b=1;
//cout<<"aa "<<dist_c<<' '<<dist_f<<'\n';
for(int i=0; i<sz(c)-dist_c; i++){
z.pb(add_and({c[i],c[aux]}));
aux++;
}
aux=dist_f;
//cout<<"ss"<<'\n';
for(int i=0; i<sz(f)-dist_f; i++){
q.pb(add_and({f[i],f[aux]}));
aux++;
}
if(!(sz(z) && sz(q)))return;
a=add_or(z);
b=add_or(q);
ans.pb(add_and({a,b}));
q.clear();
z.clear();
//cout<<"ns"<<'\n';
}
void construct_network(int H, int W, int K){
n=H;
m=W;
k=K;
for(int i=0; i<n; i++){//por filas
for(int j=0; j<m; j++){
q.pb(i*m+j);
}
f.pb(add_or(q));
q.clear();
}
for(int j=0; j<m; j++){//por columnas
for(int i=0; i<n; i++){
z.pb(i*m+j);
}
c.pb(add_or(z));
z.clear();
}
//diferentes columnas y filas
for(int dis=1; dis<k; dis++){
looks(dis, k-dis);
}
//cout<<"avocado???????????????????????????????????"<<'\n';
int a=add_or({add_xor(c),add_xor(f)});//debe ser 1 else 0
//cout<<a<<" waaaaaaaaaaa"<<'\n';
z.clear();
q.clear();
//igual columna
int aux=k;
for(int i=0; i<sz(c)-k; i++){
z.pb(add_and({c[i],c[aux]}));
aux++;
}
int b=0;
if(sz(z)){
b=add_and({a,add_or(z)});
ans.pb(b);
}
//cout<<sz(ans)<<"<<<<<<<<"<< '\n';
// igual fila
aux=k;
for(int i=0; i<sz(f)-k; i++){
q.pb(add_and({f[i],f[aux]}));
aux++;
}
if(sz(q)){
//cout<<"nsssss"<<'\n';
b=add_and({a,add_or(q)});
ans.pb(b);
}
add_or(ans);
return;
}
# | 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... |