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<bits/stdc++.h>
using namespace std;
#include "vision.h"
void construct_network(int H, int W, int K) {
auto valid = [&] (int x, int y) -> bool {
return x >= 0 && x < H && y >= 0 && y < W;
};
int last = H * W;
int ans = 0;
set<pair<pair<int,int>,pair<int,int>>>s;
for(int i = 0 ; i < H ; i++) {
for(int j = 0 ; j < W ; j++) {
int cnt = 0;
for(int k = 0 ; k < H ; k++) {
int idx = K - abs(i-k);
if(idx < 0)
continue;
if(idx == 0)
cnt++;
if(cnt == 2)
break;
if(valid(k, j + idx)) {
if(s.count({{i,j},{k, j+idx}}) || s.count({{k, j+idx}, {i,j}}))
continue;
s.insert({{i,j},{k, j+idx}});
add_and({(i)*W + j, (k)*W + j + idx});
last++;
}
}
break;
}
break;
}
vector<int>R;
for(int i = H*W ; i < last ; i++)
R.push_back(i);
add_or(R);
}
Compilation message (stderr)
vision.cpp: In function 'void construct_network(int, int, int)':
vision.cpp:13:9: warning: unused variable 'ans' [-Wunused-variable]
13 | int ans = 0;
| ^~~
# | 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... |