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;
#define dbgv(v) cout<<#v<<" = "; f(i,0,int(v.size())) cout<<v[i]<<" "; cout<<endl
#define dbga(a,x,y) cout<<#a<<" = "; f(i,x,y) cout<<a[i]<<" "; cout<<endl
#define erorp(x) cout<<#x<<"={"<<x.F<<" , "<<x.S<<"}"<<endl
#define eror(x) cout<<#x<<'='<<(x)<<endl
#define f_(i,a,b) for(int i=a;i>=b;i--)
#define f(i,a,b) for(int i=a;i<b;i++)
#define nb(x) __builtin_popcount(x)
#define all(v) v.begin(),v.end()
#define bit(n,k) (((n)>>(k))&1)
#define Add(x,y) x=(x+y)%mod
#define maxm(a,b) a=max(a,b)
#define minm(a,b) a=min(a,b)
#define lst(x) x[x.size()-1]
#define sz(x) int(x.size())
#define mp make_pair
#define ll long long
#define pb push_back
#define S second
#define F first
const int N=222,lg=12;
int n,m,k,row[N],col[N],a[N][N],R[lg],C[lg],res[lg],prt[N];
void construct_network(int _n, int _m, int _k){
n=_n,m=_m,k=_k;
int z=0;
f(i,0,n){
f(j,0,m){
a[i][j]=z++;
}
}
f(i,0,n){
vector<int> vec;
f(j,0,m) vec.pb(a[i][j]);
row[i]=add_or(vec);
}
f(j,0,m){
vector<int> vec;
f(i,0,n) vec.pb(a[i][j]);
col[j]=add_or(vec);
}
f(l,0,lg){
f(i,0,n){
vector<int> vec;
f(j,0,n){
if(bit(abs(i-j),l)){
vec.pb(row[j]);
}
}
if(vec.size()){
prt[i]=add_and({row[i],add_or(vec)});
}
else{
prt[i]=add_xor({0,0});
}
}
vector<int> p;
f(i,0,n) p.pb(prt[i]);
R[l]=add_or(p);
}
f(l,0,lg){
f(i,0,m){
vector<int> vec;
f(j,0,m){
if(bit(abs(i-j),l)){
vec.pb(col[j]);
}
}
if(vec.size()){
prt[i]=add_and({col[i],add_or(vec)});
}
else{
prt[i]=add_xor({0,0});
}
}
vector<int> p;
f(i,0,m) p.pb(prt[i]);
C[l]=add_or(p);
}
//f(l,0,lg) add_or({R[l]});
//return ;
int now=add_xor({0,0});
f(l,0,lg){
res[l]=add_xor({now,R[l],C[l]});
now=add_or({now,add_and({R[l],C[l]})});
now=add_and({now,add_or({R[l],C[l]})});
}
vector<int> vec;
f(l,0,lg){
if(bit(k,l)==1){
vec.pb(res[l]);
}
else{
vec.pb(add_not(res[l]));
}
}
add_and(vec);
}
/*
2 2 2
0 0 1 1
1
-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... |