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 "grader.cpp"
#include "vision.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
void construct_network(int H, int W, int K) {
int ind=H*W-1;
vector<int>v;
for (int i=0;i<H;i++){
for (int j=0;j<W;j++){
vector<int>Ask;
for (int x=0;x<=K;x++){
int y=K-x;
for (int dx:{-1,1}){
for (int dy:{-1,1}){
int nx=i+x*dx,ny=j+y*dy;
if (nx<0 || nx>=H || ny<0 || ny>=W) continue;
Ask.push_back(nx*W+ny);
}
}
}
if (!Ask.empty()){
add_or(Ask);
ind++;
add_and({ind,i*W+j});
ind++;
v.push_back(ind);
}
}
}
add_or(v);
}
/**
2 3 3
0 0 0 1
0 0 0 2
0 0 1 0
0 0 1 1
0 0 1 2
0 1 0 2
0 1 1 0
0 1 1 1
0 1 1 2
0 2 1 0
0 2 1 1
0 2 1 2
1 0 1 1
1 0 1 2
1 1 1 2
-1
**/
# | 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... |