This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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;
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}));
}
add_or(blub);
}
Compilation message (stderr)
vision.cpp: In function 'void construct_network(int, int, int)':
vision.cpp:31: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]
31 | for (int i= 0; i<prs.size(); i++) {
| ~^~~~~~~~~~~
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |