# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
612719 | morete | Vision Program (IOI19_vision) | C++17 | 0 ms | 0 KiB |
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"
int f(int i, int j, int W){
return i*W + j;
}
bool is(int i, int j){
if(i < 0 || i >= H || j < 0 || j >= W) return false;
return true;
}
void construct_network(int H, int W, int K) {
int cap = 1; int last = 0;
for(int i = 0; i < H && cap < 10000; i++){
for(int j = 0; j < W && cap < 10000; j++){
for(int k = 0; k < H && cap < 10000; k++){
for(int l = 0; l < W && cap < 10000; l++){
if(abs(i - k) + abs(j - l) == K){
last = add_and({f(i, j), f(k, l)});
cap++;
}
}
}
}
}
vector<int> v;
for(int i = H*W; i <= last; i++) v.push_back(i);
add_or(v);
}