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;
#define ll int
#define ff first
#define ss second
#define ln "\n"
#define ld long double
ll h, w, k;
ll encode(ll i, ll j){
return i*w+j;
}
pair<ll,ll> decode(ll x){
return {x/w, x%w};
}
vector<pair<ll, ll>> mult = {{1, 1}, {-1, -1}, {-1, 1}, {1, -1}};
void construct_network(int H, int W, int K) {
h=H; w=W; k=K;
vector<ll> fs;
for (ll i=0; i<h; i++){
for (ll j=0; j<w; j++){
if (i!=0 and j!=0) continue;
vector<ll> qry;
for (ll ri=0; ri<=k; ri++){
ll rj = k-ri;
for (auto mch:mult){
ll ni = i+mch.ff*ri, nj = j+mch.ss*rj;
if (ni>=0 and ni<h and nj>=0 and nj<w){
qry.push_back(encode(ni, nj));
}
}
}
if (!qry.size()) continue;
fs.push_back(add_and({add_or(qry), encode(i, j)}));
}
}
add_or(fs);
}
# | 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... |