# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
424692 | TryMax | 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 "vision.h"
#include <bits/stdc++.h>
#ifdef LOCAL
#include "grader.cpp"
#endif // LOCAL
#define pb push_back
const int N = 1e5 + 10;
int n, m, k;
int dist(int x, int y, int x1, int y1){
return abs(x - x1) + abs(y - y1);
}
int pos(int x, int y){
return x * m + y;
}
void construct_network(int N, int M, int K){
n = N;
m = M;
k = K;
int last = 0;
for(int i = 0; i < n; ++i)
for(int j = 0; j < m; ++j)
for(int i1 = i; i1 < n; ++i1)
for(int j1 = 0; j1 < m; ++j1)
if(dist(i, j, i1, j1) == k){
vector<int> q;
q.pb(pos(i, j));
q.pb(pos(i1, j1));
last = add_and(q);
}
vector<int> q;
for(int i = N * M; i <= last; ++i)
q.pb(i);
add_or(q);
}
/*
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
*/