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;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
#define ff first
#define ss second
#define all(v) v.begin(), v.end()
#define FOR(i, n) for (int i = 0; i < n; i++)
int h, w;
vector<pii> get_dist(int k, int x, int y){
vector<pii> tmp, res;
FOR(i, k) tmp.push_back({x + k - i, y + i});
FOR(i, k) tmp.push_back({x - i, y + k - i});
for (auto [i, j] : tmp) {
if(i < 0 || i >= w) continue;
if(j < 0 || j >= h) continue;
res.push_back({i, j});
}
return res;
}
int coord(int x, int y){
return w * y + x;
}
void construct_network(int H, int W, int K) {
h = H;
w = W;
vector<int> res;
FOR(i, w) FOR(j, h){
vector<int> q;
for (auto d : get_dist(K, i, j)) {
q.push_back(coord(d.ff, d.ss));
}
if(q.empty()) continue;
int a = add_or(q);
res.push_back(add_and({a, coord(i, j)}));
}
add_or(res);
}
# | 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... |