#include"vision.h"
#include<iostream>
#include<vector>
using namespace std;
int w,h;
int get_cell(int x,int y){
return y*w+x;
}
int construct_diagonal1(int x,int y){
vector<int>ins;
while(x<w&&y<h){
ins.push_back(get_cell(x,y));
x++;
y++;
}
return add_or(ins);
}
int construct_diagonal2(int x,int y){
vector<int>ins;
while(x>=0&&y<h){
ins.push_back(get_cell(x,y));
x--;
y++;
}
return add_or(ins);
}
vector<int>func1(vector<int>arr1,int k){
vector<int>arr2;
for(int i=0;i+k<=(int)arr1.size();i++){
vector<int>vec;
for(int j=i;j<i+k;j++){
vec.push_back(arr1[j]);
}
int gor=add_or(vec);
int gxor=add_xor(vec);
int gnxor=add_not(gxor);
arr2.push_back(add_and({gor,gnxor}));
}
return arr2;
}
void construct_network(int H,int W,int k){
w=W;
h=H;
vector<int>diagonals1;
for(int y=h-1;y>0;y--)
diagonals1.push_back(construct_diagonal1(0,y));
for(int x=0;x<w;x++)
diagonals1.push_back(construct_diagonal1(x,0));
vector<int>diagonals2;
for(int x=0;x<w;x++)
diagonals2.push_back(construct_diagonal2(x,0));
for(int y=1;y<h;y++)
diagonals2.push_back(construct_diagonal2(w-1,y));
vector<int>intervals1,intervals2;
vector<int>res;
int or1=add_or(func1(diagonals1,k));
int or2=add_or(func1(diagonals2,k));
int or3=add_or(func1(diagonals1,k+1));
int or4=add_or(func1(diagonals2,k+1));
int and1=add_and({or1,or2});
int and2=add_and({or3,or4});
int not1=add_not(and1);
add_and({and2,not1});
/*res=func1(diagonals1,k);
intervals1.insert(intervals1.end(),res.begin(),res.end());
res=func1(diagonals2,k);
intervals1.insert(intervals1.end(),res.begin(),res.end());
res=func1(diagonals1,k-1);
intervals2.insert(intervals2.end(),res.begin(),res.end());
res=func1(diagonals2,k-1);
intervals2.insert(intervals2.end(),res.begin(),res.end());
int ork=add_or(intervals1);
int ork1=add_or(intervals2);
int nork1=add_not(ork1);
add_and({ork,nork1});*/
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
436 KB |
Output is correct |
2 |
Correct |
0 ms |
432 KB |
Output is correct |
3 |
Correct |
0 ms |
440 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Incorrect |
1 ms |
348 KB |
on inputs (0, 1), (1, 0), expected 1, but computed 0 |
7 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
436 KB |
Output is correct |
2 |
Correct |
0 ms |
432 KB |
Output is correct |
3 |
Correct |
0 ms |
440 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Incorrect |
1 ms |
348 KB |
on inputs (0, 1), (1, 0), expected 1, but computed 0 |
7 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
436 KB |
Output is correct |
2 |
Correct |
0 ms |
432 KB |
Output is correct |
3 |
Correct |
0 ms |
440 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Incorrect |
1 ms |
348 KB |
on inputs (0, 1), (1, 0), expected 1, but computed 0 |
7 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
436 KB |
Output is correct |
2 |
Correct |
0 ms |
432 KB |
Output is correct |
3 |
Correct |
0 ms |
440 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Incorrect |
1 ms |
348 KB |
on inputs (0, 1), (1, 0), expected 1, but computed 0 |
7 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
604 KB |
Output is correct |
2 |
Correct |
9 ms |
1112 KB |
Output is correct |
3 |
Correct |
7 ms |
1116 KB |
Output is correct |
4 |
Correct |
1 ms |
348 KB |
Output is correct |
5 |
Correct |
2 ms |
684 KB |
Output is correct |
6 |
Correct |
9 ms |
1124 KB |
Output is correct |
7 |
Correct |
6 ms |
944 KB |
Output is correct |
8 |
Correct |
1 ms |
356 KB |
Output is correct |
9 |
Correct |
2 ms |
604 KB |
Output is correct |
10 |
Correct |
6 ms |
1116 KB |
Output is correct |
11 |
Correct |
7 ms |
1116 KB |
Output is correct |
12 |
Correct |
8 ms |
1148 KB |
Output is correct |
13 |
Correct |
5 ms |
948 KB |
Output is correct |
14 |
Correct |
1 ms |
432 KB |
Output is correct |
15 |
Correct |
2 ms |
696 KB |
Output is correct |
16 |
Correct |
5 ms |
1116 KB |
Output is correct |
17 |
Correct |
9 ms |
1164 KB |
Output is correct |
18 |
Correct |
7 ms |
1064 KB |
Output is correct |
19 |
Correct |
7 ms |
956 KB |
Output is correct |
20 |
Correct |
1 ms |
436 KB |
Output is correct |
21 |
Correct |
0 ms |
360 KB |
Output is correct |
22 |
Correct |
0 ms |
356 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
432 KB |
Output is correct |
2 |
Incorrect |
1 ms |
360 KB |
on inputs (0, 0), (1, 1), expected 1, but computed 0 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
9 ms |
1592 KB |
Output is correct |
2 |
Correct |
1 ms |
452 KB |
Output is correct |
3 |
Correct |
2 ms |
608 KB |
Output is correct |
4 |
Correct |
2 ms |
616 KB |
Output is correct |
5 |
Correct |
2 ms |
612 KB |
Output is correct |
6 |
Correct |
2 ms |
608 KB |
Output is correct |
7 |
Correct |
5 ms |
1240 KB |
Output is correct |
8 |
Correct |
5 ms |
1072 KB |
Output is correct |
9 |
Correct |
10 ms |
1752 KB |
Output is correct |
10 |
Correct |
0 ms |
348 KB |
Output is correct |
11 |
Correct |
0 ms |
432 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
436 KB |
Output is correct |
2 |
Correct |
0 ms |
432 KB |
Output is correct |
3 |
Correct |
0 ms |
440 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Incorrect |
1 ms |
348 KB |
on inputs (0, 1), (1, 0), expected 1, but computed 0 |
7 |
Halted |
0 ms |
0 KB |
- |