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 ll long long
using namespace std;
int N,M,K;
vector<int> bigor;
int getbit(int x,int y){
return (x-1)*M+(y-1);
}
vector<int> getd(int x,int y,int dx,int dy){
vector<int> V;
while(x<=N and y<=M and x>=1 and y>=1){
// cout<<x<<" "<<y<<endl;
V.push_back(getbit(x,y));
x+=dx;
y+=dy;
}
return V;
}
int dva1(vector<int> V){
int x=add_xor(V);
int orr=add_or(V);
int nx=add_not(x);
return add_and({orr,nx});
}
void construct_network(int h, int w, int k){
N=h;
M=w;
K=k;
vector<int> D1,D2;
for(int j=1;j<=M;j++)
D1.push_back(add_or(getd(1,j,1,-1)));
for(int i=2;i<=N;i++)
D1.push_back(add_or(getd(i,M,1,-1)));
for(int i=N;i>=2;i--)
D2.push_back(add_or(getd(i,1,1,1)));
for(int j=1;j<=M;j++)
D2.push_back(add_or(getd(1,j,1,1)));
// cout<<"OVDE"<<endl;
vector<int> tk1,bk1;
for(int i=0;i+K<D1.size();i++){
tk1.push_back(add_and({D1[i],D1[i+K]}));
vector<int> V;
for(int j=i;j<=i+K;j++)
V.push_back(D1[j]);
bk1.push_back(dva1(V));
}
int xor1=add_xor(D1);
bk1.push_back(xor1);
int b1=add_or(bk1),t1=add_or(tk1);
vector<int> tk2,bk2;
for(int i=0;i+K<D2.size();i++){
tk2.push_back(add_and({D2[i],D2[i+K]}));
vector<int> V;
for(int j=i;j<=i+K;j++)
V.push_back(D2[j]);
bk2.push_back(dva1(V));
}
int xor2=add_xor(D2);
bk2.push_back(xor2);
int b2=add_or(bk2),t2=add_or(tk2);
int aaa=add_and({b1,b2});
int bbb=add_or({t1,t2});
add_and({aaa,bbb});
}
Compilation message (stderr)
vision.cpp: In function 'void construct_network(int, int, int)':
vision.cpp:44:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
44 | for(int i=0;i+K<D1.size();i++){
| ~~~^~~~~~~~~~
vision.cpp:57:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
57 | for(int i=0;i+K<D2.size();i++){
| ~~~^~~~~~~~~~
# | 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... |