#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]=idx++;
add_or(a[i]);
}
for(int i=0;i<N;i++){
num_b[i]=idx++;
add_or(b[i]);
}
vector<int> pre_a(N),pre_b(N);
vector<int> suf_a(N),suf_b(N);
vector<int> tmp;
pre_a[0]=idx++;
tmp.push_back(num_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]);
add_or(tmp);
tmp.clear();
pre_a[i]=idx++;
}
pre_b[0]=idx++;
tmp.push_back(num_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]);
add_or(tmp);
tmp.clear();
pre_b[i]=idx++;
}
suf_a[N-1]=idx++;
tmp.push_back(num_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]);
add_or(tmp);
tmp.clear();
suf_a[i]=idx++;
}
suf_b[N-1]=idx++;
tmp.push_back(num_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]);
add_or(tmp);
tmp.clear();
suf_b[i]=idx++;
}
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;
}
idx++;
add_or(tmp);
tmp.clear();
tmp.push_back(num_a[i]);
tmp.push_back(idx);
add_and(tmp);
tmp.clear();
add_not(idx);
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;
}
idx++;
add_or(tmp);
tmp.clear();
tmp.push_back(num_b[i]);
tmp.push_back(idx);
add_and(tmp);
tmp.clear();
add_not(idx);
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]);
add_and(tmp);
tmp.clear();
want.push_back(idx++);
}
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]);
add_and(tmp);
tmp.clear();
want.push_back(idx++);
}
int yes=idx++;
add_or(want);
int no=idx++;
add_and(mx);
tmp.push_back(yes);
tmp.push_back(no);
add_and(tmp);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
WA in grader: Invalid index |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
WA in grader: Invalid index |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
WA in grader: Invalid index |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
WA in grader: Invalid index |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
360 KB |
WA in grader: Invalid index |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
WA in grader: Invalid index |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
3 ms |
1236 KB |
WA in grader: Invalid index |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
WA in grader: Invalid index |
2 |
Halted |
0 ms |
0 KB |
- |