#include "vision.h"
#include<bits/stdc++.h>
using namespace std;
typedef int ll;
void construct_network(int H, int W, int K) {
vector<ll> ia, da;
for(int i=0; i<W; i++)
{
vector<ll> temp;
for(int j=0; j<=min(i,H-1); j++)
temp.push_back((i-j)+(W*j));
ia.push_back(add_or(temp));
}
for(int i=1; i<H; i++)
{
vector<ll> temp;
for(int j=0; j<W; j++)
if(j+i<H)
temp.push_back((W-j-1)+(W*(j+i)));
ia.push_back(add_or(temp));
}
for(int i=W-1; i>-1; i--)
{
vector<ll> temp;
for(int j=0; j<=min(H-1,W-i-1); j++)
{
temp.push_back((i+j)+(W*j));
}
da.push_back(add_or(temp));
}
for(int i=1; i<H; i++)
{
vector<ll> temp;
for(int j=0; j+i<W; j++)
if(j+i<H)
temp.push_back(j+(W*(j+i)));
da.push_back(add_or(temp));
}
vector<ll> asd1;
for(int i=0; i<ia.size()-K; i++)
{
vector<int> sub_vector(ia.begin() + i, ia.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<da.size()-K; i++)
{
vector<int> sub_vector(da.begin() + i, da.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)});
if(K==1)
{
return;
}
asd1.clear();
for(int i=0; i<ia.size()-K+1; i++)
{
vector<int> sub_vector(ia.begin() + i, ia.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<da.size()-K+1; i++)
{
vector<int> sub_vector(da.begin() + i, da.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:42:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
42 | for(int i=0; i<ia.size()-K; i++)
| ~^~~~~~~~~~~~
vision.cpp:51:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
51 | for(int i=0; i<da.size()-K; i++)
| ~^~~~~~~~~~~~
vision.cpp:65:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
65 | for(int i=0; i<ia.size()-K+1; i++)
| ~^~~~~~~~~~~~~~
vision.cpp:74:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
74 | for(int i=0; i<da.size()-K+1; i++)
| ~^~~~~~~~~~~~~~
vision.cpp:83:5: warning: unused variable 'ans' [-Wunused-variable]
83 | ll ans=add_and({bsk_1,add_not(bsk_2)});
| ^~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
3 |
Incorrect |
0 ms |
348 KB |
WA in grader: Instruction with no inputs |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
3 |
Incorrect |
0 ms |
348 KB |
WA in grader: Instruction with no inputs |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
3 |
Incorrect |
0 ms |
348 KB |
WA in grader: Instruction with no inputs |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
3 |
Incorrect |
0 ms |
348 KB |
WA in grader: Instruction with no inputs |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
5 ms |
1116 KB |
Output is correct |
3 |
Correct |
8 ms |
1140 KB |
Output is correct |
4 |
Correct |
0 ms |
344 KB |
Output is correct |
5 |
Incorrect |
0 ms |
348 KB |
WA in grader: Instruction with no inputs |
6 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Incorrect |
0 ms |
344 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 |
6 ms |
1372 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Incorrect |
0 ms |
348 KB |
WA in grader: Instruction with no inputs |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
3 |
Incorrect |
0 ms |
348 KB |
WA in grader: Instruction with no inputs |
4 |
Halted |
0 ms |
0 KB |
- |