#include "vision.h"
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define F first
#define S second
#define all(x) (x).begin(), (x).end()
template<typename T, typename U>
ostream &operator<<(ostream &os, const pair<T, U> &p)
{
return os << "(" << p.F << "," << p.S << ")";
}
template<typename T>
void print(const T &v, int lim = 1e9)
{
for(auto x : v)
if(lim-- > 0) cout << x << " ";
cout << endl;
}
template<typename T>
void print(T *begin, const T *end)
{
for(T *it = begin; it < end; it++)
cout << *it << " ";
cout << endl;
}
void construct_network(int H, int W, int K) {
auto idx = [&](int x, int y)
{
//cout << "pixel " << x << ' ' << y << endl;
return x * W + y;
};
vector<pair<int, int>> pairs;
for(int i = 0; i < H; i++)
{
for(int j = 0; j < W; j++)
{
for(int x = 0; x <= K; x++)
{
int y = K - x;
// cout << x << " " << y << " " << K << endl;
// if(y < 0)
// {
// cout << "wtf" << endl;
// return;
// }
// assert(y >= 0);
if(i + x < H && j + y < W)
pairs.emplace_back(idx(i, j), idx(i + x, j + y));
if(i + x < H && j - y >= 0)
pairs.emplace_back(idx(i, j), idx(i + x, j - y));
}
}
}
//add_and({0, 1});
vector<int> v;
int j = H * W;
for(auto [idx1, idx2] : pairs)
{
//cout << idx1 << ' ' << idx2 << endl;
add_and({idx1, idx2});
v.push_back(j++);
}
add_or(v);
}
# | 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... |