#include <bits/stdc++.h>
#include "vision.h"
#define loc(i, j) i*W+j
#define adv1(x) x.push_back(base + cnt);cnt++;
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;
void construct_network(int H, int W, int K) {
int cnt = 0;
int base = H*W;
vector<int> indires;
vector<int> pos, neg;
for (int i = -W+1; i < H; i++)
{
int cur = i;
vector<int> locs;
for (int j = 0; j < W; j++)
{
if (cur >= 0 && cur < H) {
locs.push_back(loc(cur, j));
}
cur++;
}
add_or(locs);
adv1(pos)
}
for (int i = 0; i < H+W-1; i++)
{
int cur = i;
vector<int> locs;
for (int j = 0; j < W; j++)
{
if (cur >= 0 && cur < H) {
locs.push_back(loc(cur, j));
}
cur--;
}
add_or(locs);
adv1(neg)
}
for (int i = 0; i < pos.size()-K; i++)
{
add_and({pos[i], pos[i+K]});
adv1(indires)
}
for (int i = 0; i < neg.size()-K; i++)
{
add_and({neg[i], neg[i+K]});
adv1(indires);
}
add_or(indires);
int val1 = base + (cnt++);
indires.clear();
for (int i = 0; i < pos.size()-K-1; i++)
{
add_and({pos[i], pos[i+K]});
adv1(indires)
}
for (int i = 0; i < neg.size()-K-1; i++)
{
add_and({neg[i], neg[i+K]});
adv1(indires);
}
if (indires.empty()) {
add_and({0, 1, 2});
}
else {
add_or(indires);
}
add_not(base + (cnt++));
add_and({val1, base + cnt});
}
Compilation message
vision.cpp: In function 'void construct_network(int, int, int)':
vision.cpp:45:23: 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 < pos.size()-K; i++)
| ~~^~~~~~~~~~~~~~
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 < neg.size()-K; i++)
| ~~^~~~~~~~~~~~~~
vision.cpp:58:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
58 | for (int i = 0; i < pos.size()-K-1; i++)
| ~~^~~~~~~~~~~~~~~~
vision.cpp:63:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
63 | for (int i = 0; i < neg.size()-K-1; i++)
| ~~^~~~~~~~~~~~~~~~
# |
결과 |
실행 시간 |
메모리 |
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 |
- |
# |
결과 |
실행 시간 |
메모리 |
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 |
- |
# |
결과 |
실행 시간 |
메모리 |
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 |
- |
# |
결과 |
실행 시간 |
메모리 |
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 |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
340 KB |
on inputs (0, 0), (0, 1), expected 1, but computed 0 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
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 |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
12 ms |
1248 KB |
on inputs (80, 199), (81, 199), expected 1, but computed 0 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
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 |
- |