#include "vision.h"
#include <bits/stdc++.h>
using namespace std;
typedef vector<int> vi;
int h, w, k;
int cw;
int pnt(int x, int y)
{
return x + (y * w);
}
int has2(vi v)
{
return add_and({ add_or(v), add_not(add_xor(v)) });
} // 4 puertas
void construct_network(int H, int W, int K)
{
h = H;
w = W;
k = K;
vi d11, d12;
for (int d = -201; d < 202; d++) {
vi th;
for (int i = 0; i < w; i++)
for (int j = 0; j < h; j++)
if (abs(i - j + d) <= 0 && i - j + d <= 0)
th.push_back(pnt(i, j));
if (th.size()) {
d11.push_back(add_or(th));
d12.push_back(has2(th));
}
}
vi d21, d22;
for (int d = -201; d < 202; d++) {
vi th;
for (int i = 0; i < w; i++)
for (int j = 0; j < h; j++)
if (abs(i + j + d) <= 0 && i + j + d <= 0)
th.push_back(pnt(i, j));
if (th.size()) {
d21.push_back(add_or(th));
d22.push_back(has2(th));
}
}
vi d1;
for (int i = 0; i < d11.size(); i++) {
vi s1, s2;
for (int d = 0; d <= k; d++) {
s1.push_back(d11[i + d]);
s2.push_back(d12[i + d]);
}
if (s1.size())
d1.push_back(add_or({ has2(s1), add_or(s2) }));
}
vi d2;
for (int i = 0; i < d21.size(); i++) {
vi s1, s2;
for (int d = 0; d <= k; d++) {
s1.push_back(d21[i + d]);
s2.push_back(d22[i + d]);
}
if (s1.size())
d2.push_back(add_or({ has2(s1), add_or(s2) }));
}
int tc = add_and({ has2(d1), has2(d2) });
int nf = add_and({ add_or(d1), add_or(d2) });
add_and({ nf, add_not(tc) });
}
Compilation message
vision.cpp: In function 'void construct_network(int, int, int)':
vision.cpp:50:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
50 | for (int i = 0; i < d11.size(); i++) {
| ~~^~~~~~~~~~~~
vision.cpp:60:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
60 | for (int i = 0; i < d21.size(); i++) {
| ~~^~~~~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
on inputs (0, 0), (0, 1), expected 1, but computed 0 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
on inputs (0, 0), (0, 1), expected 1, but computed 0 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
on inputs (0, 0), (0, 1), expected 1, but computed 0 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
on inputs (0, 0), (0, 1), expected 1, but computed 0 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
664 KB |
on inputs (0, 0), (0, 1), expected 1, but computed 0 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
on inputs (0, 0), (0, 1), expected 1, but computed 0 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
20 ms |
1376 KB |
WA in grader: Invalid index |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
on inputs (0, 0), (0, 1), expected 1, but computed 0 |
2 |
Halted |
0 ms |
0 KB |
- |