#include "vision.h"
#include<bits/stdc++.h>
using namespace std;
int convert(pair<int, int> cords, int H, int W) {
return cords.first*W + cords.second;
}
void construct_network(int H, int W, int K) {
vector<pair<int, int>> prs;
int i = 0, j=0;
// for (int i=0; i<H; i++) {
// for (int j = 0; j<W; j++) {
for (int k = max(0, i-K); k<min(H, i+K); k++) {
for (int l = max(0, j-K); l<min(W, j+K); l++) {
if (abs(i-k) + abs(j-l) == K) {
prs.push_back({min(convert({k,l}, H, W), convert({i,j}, H, W)), max(convert({k,l}, H, W), convert({i,j}, H, W))});
}
}
}
// }
// }
sort(prs.begin(), prs.end());
prs.erase(unique(prs.begin(), prs.end()), prs.end());
vector<int> blub;
for (int i= 0; i<prs.size(); i++) {
blub.push_back(add_and(vector<int>{prs[i].first, prs[i].second}));
}
if(blub.empty()) {add_not(0);}
else add_or(blub);
}
Compilation message
vision.cpp: In function 'void construct_network(int, int, int)':
vision.cpp:33:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
33 | for (int i= 0; i<prs.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 |
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 (126, 120), (176, 169), expected 0, but computed 1 |
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 |
- |