#include<bits/stdc++.h>
#include "vision.h"
using namespace std;
typedef int ll;
void construct_network(int H, int W, int K) {
vector<vector<ll>> ia(H+W-1), da(H+W-1);
vector<ll>iaor,daor;
for(int i=0; i<H; i++){
for(int j=0; j<W; j++){
ia[i+j].push_back(i*W+j);
da[i-j+W-1].push_back(i*W+j);
}
}
for(auto i:ia) if(i.size()>0) iaor.push_back(add_or(i));
for(auto i:da) if(i.size()>0) daor.push_back(add_or(i));
vector<ll> asd1;
for(int i=0; i<iaor.size()-K; i++)
{
vector<int> sub_vector(iaor.begin() + i, iaor.begin() + i+K+1);
ll a=add_xor(sub_vector);
ll b=add_not(a);
ll c=add_or(sub_vector);
asd1.push_back(add_and({b,c}));
}
vector<ll> asd2;
for(int i=0; i<daor.size()-K; i++)
{
vector<int> sub_vector(daor.begin() + i, daor.begin() + i+K+1);
ll a=add_xor(sub_vector);
ll b=add_not(a);
ll c=add_or(sub_vector);
asd2.push_back(add_and({b,c}));
}
ll bsk_1=add_and({add_or(asd1),add_or(asd2)});
asd1.clear();
for(int i=0; i<iaor.size()-K+1; i++)
{
vector<int> sub_vector(iaor.begin() + i, iaor.begin() + i+K);
ll a=add_xor(sub_vector);
ll b=add_not(a);
ll c=add_or(sub_vector);
asd1.push_back(add_and({b,c}));
}
asd2.clear();
for(int i=0; i<daor.size()-K+1; i++)
{
vector<int> sub_vector(daor.begin() + i, daor.begin() + i+K);
ll a=add_xor(sub_vector);
ll b=add_not(a);
ll c=add_or(sub_vector);
asd2.push_back(add_and({b,c}));
}
ll bsk_2=add_and({add_or(asd1),add_or(asd2)});
ll ans=add_and({bsk_1,add_not(bsk_2)});
}
Compilation message
vision.cpp: In function 'void construct_network(int, int, int)':
vision.cpp:17:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
17 | for(int i=0; i<iaor.size()-K; i++)
| ~^~~~~~~~~~~~~~
vision.cpp:26:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
26 | for(int i=0; i<daor.size()-K; i++)
| ~^~~~~~~~~~~~~~
vision.cpp:36:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
36 | for(int i=0; i<iaor.size()-K+1; i++)
| ~^~~~~~~~~~~~~~~~
vision.cpp:45:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
45 | for(int i=0; i<daor.size()-K+1; i++)
| ~^~~~~~~~~~~~~~~~
vision.cpp:54:5: warning: unused variable 'ans' [-Wunused-variable]
54 | ll ans=add_and({bsk_1,add_not(bsk_2)});
| ^~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
344 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Incorrect |
0 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 |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
344 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Incorrect |
0 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 |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
344 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Incorrect |
0 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 |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
344 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Incorrect |
0 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 |
1 ms |
692 KB |
Output is correct |
2 |
Correct |
4 ms |
1048 KB |
Output is correct |
3 |
Correct |
5 ms |
1116 KB |
Output is correct |
4 |
Correct |
1 ms |
432 KB |
Output is correct |
5 |
Correct |
1 ms |
752 KB |
Output is correct |
6 |
Correct |
4 ms |
1116 KB |
Output is correct |
7 |
Correct |
4 ms |
1116 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
1 ms |
600 KB |
Output is correct |
10 |
Correct |
3 ms |
1116 KB |
Output is correct |
11 |
Correct |
4 ms |
1196 KB |
Output is correct |
12 |
Correct |
5 ms |
1204 KB |
Output is correct |
13 |
Correct |
4 ms |
860 KB |
Output is correct |
14 |
Correct |
1 ms |
348 KB |
Output is correct |
15 |
Correct |
1 ms |
604 KB |
Output is correct |
16 |
Correct |
4 ms |
1116 KB |
Output is correct |
17 |
Correct |
4 ms |
1092 KB |
Output is correct |
18 |
Correct |
5 ms |
1112 KB |
Output is correct |
19 |
Correct |
4 ms |
860 KB |
Output is correct |
20 |
Correct |
0 ms |
348 KB |
Output is correct |
21 |
Correct |
1 ms |
348 KB |
Output is correct |
22 |
Correct |
0 ms |
420 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Incorrect |
1 ms |
348 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 |
7 ms |
2260 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
604 KB |
Output is correct |
4 |
Correct |
2 ms |
860 KB |
Output is correct |
5 |
Correct |
1 ms |
604 KB |
Output is correct |
6 |
Correct |
1 ms |
604 KB |
Output is correct |
7 |
Correct |
4 ms |
1244 KB |
Output is correct |
8 |
Correct |
3 ms |
1240 KB |
Output is correct |
9 |
Correct |
7 ms |
2216 KB |
Output is correct |
10 |
Correct |
0 ms |
348 KB |
Output is correct |
11 |
Correct |
0 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
344 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Incorrect |
0 ms |
348 KB |
on inputs (0, 1), (1, 0), expected 1, but computed 0 |
7 |
Halted |
0 ms |
0 KB |
- |