#include "vision.h"
//#include "grader.cpp"
#include <bits/stdc++.h>
using namespace std;
const int B=20;
void construct_network(int n, int m, int K) {
int N=n+m-1;
vector<int> num_a(N),num_b(N);
vector<vector<int>> a(N),b(N);
//int idx=n*m;
for(int i=0;i<n;i++){
for(int j=0;j<m;j++){
a[i+j].push_back(i*n+j);
b[j+n-1-i].push_back(i*n+j);
}
}
for(int i=0;i<N;i++){
num_a[i]=add_or(a[i]);
}
for(int i=0;i<N;i++){
num_b[i]=add_or(b[i]);
}
vector<int> pre_a(N),pre_b(N);
vector<int> suf_a(N),suf_b(N);
vector<int> tmp;
tmp.push_back(num_a[0]);
pre_a[0]=add_or(tmp);
tmp.clear();
for(int i=1;i<N;i++){
tmp.push_back(num_a[i]);
tmp.push_back(pre_a[i-1]);
pre_a[i]=add_or(tmp);
tmp.clear();
}
tmp.push_back(num_b[0]);
pre_b[0]=add_or(tmp);
tmp.clear();
for(int i=1;i<N;i++){
tmp.push_back(num_b[i]);
tmp.push_back(pre_b[i-1]);
pre_b[i]=add_or(tmp);
tmp.clear();
}
tmp.push_back(num_a[N-1]);
suf_a[N-1]=add_or(tmp);
tmp.clear();
for(int i=N-2;i>=0;i--){
tmp.push_back(num_a[i]);
tmp.push_back(suf_a[i+1]);
suf_a[i]=add_or(tmp);
tmp.clear();
}
tmp.push_back(num_b[N-1]);
suf_b[N-1]=add_or(tmp);
tmp.clear();
for(int i=N-2;i>=0;i--){
tmp.push_back(num_b[i]);
tmp.push_back(suf_b[i+1]);
suf_b[i]=add_or(tmp);
tmp.clear();
}
vector<int> mx;
for(int i=0;i<N;i++){
if(i-K-1>=0){
tmp.push_back(pre_a[i-K-1]);
}
if(i+K+1<N){
tmp.push_back(suf_a[i+K+1]);
}
if(tmp.size()==0){
continue;
}
int idx=add_or(tmp);
tmp.clear();
tmp.push_back(num_a[i]);
tmp.push_back(idx);
idx=add_and(tmp);
tmp.clear();
add_not(idx);
mx.push_back(idx++);
}
for(int i=0;i<N;i++){
if(i-K-1>=0){
tmp.push_back(pre_b[i-K-1]);
}
if(i+K+1<N){
tmp.push_back(suf_b[i+K+1]);
}
if(tmp.size()==0){
continue;
}
int idx=add_or(tmp);
tmp.clear();
tmp.push_back(num_b[i]);
tmp.push_back(idx);
idx=add_and(tmp);
tmp.clear();
add_not(idx);
mx.push_back(idx++);
}
vector<int> want;
for(int i=0;i<N;i++){
if(i+K>=N){
break;
}
tmp.push_back(num_a[i]);
tmp.push_back(num_a[i+K]);
want.push_back(add_and(tmp));
tmp.clear();
}
for(int i=0;i<N;i++){
if(i+K>=N){
break;
}
tmp.push_back(num_b[i]);
tmp.push_back(num_b[i+K]);
want.push_back(add_and(tmp));
tmp.clear();
}
int yes=add_or(want);
int no=add_and(mx);
tmp.push_back(yes);
tmp.push_back(no);
add_and(tmp);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
on inputs (0, 0), (0, 1), expected 1, but computed 0 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
on inputs (0, 0), (0, 1), expected 1, but computed 0 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
on inputs (0, 0), (0, 1), expected 1, but computed 0 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
on inputs (0, 0), (0, 1), expected 1, but computed 0 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
596 KB |
on inputs (0, 0), (0, 1), expected 1, but computed 0 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
on inputs (0, 0), (0, 1), expected 1, but computed 0 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
20 ms |
2008 KB |
on inputs (80, 199), (81, 199), expected 1, but computed 0 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
on inputs (0, 0), (0, 1), expected 1, but computed 0 |
2 |
Halted |
0 ms |
0 KB |
- |