#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_or(tmp);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
on inputs (0, 0), (0, 2), expected 0, but computed 1 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
on inputs (0, 0), (0, 2), expected 0, but computed 1 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
on inputs (0, 0), (0, 2), expected 0, but computed 1 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
on inputs (0, 0), (0, 2), expected 0, but computed 1 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
556 KB |
Output is correct |
2 |
Correct |
2 ms |
468 KB |
Output is correct |
3 |
Correct |
2 ms |
468 KB |
Output is correct |
4 |
Incorrect |
1 ms |
340 KB |
WA in grader: Instruction with no inputs |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Incorrect |
1 ms |
212 KB |
WA in grader: Instruction with no inputs |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
11 ms |
2000 KB |
on inputs (126, 120), (176, 169), expected 0, but computed 1 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
on inputs (0, 0), (0, 2), expected 0, but computed 1 |
2 |
Halted |
0 ms |
0 KB |
- |