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 long long int
#define pb push_back
#define vi vector<int>
int n, m;
int last;
vector<int> D;
int c(int x, int y){
return x * m + y;
}
void construct_network(int H, int W, int K) {
n = H, m = W;
last = n*m;
if(K > 1){
// vector<int
for(int i = 0; i < n; ++i){
for(int j = 0; j < m; ++j){
for(int l = i; l < n; ++l){
for(int y = (l == i ? j + 1 : 0); y < m; ++y){
if(abs(i-l) + abs(j - y) == K){
D.pb(add_and(vi{c(i, j), c(i, j)}));
}
}
}
}
}
int c = add_or(D);
}else{
vector<int> rows;
for(int i = 0; i < n; ++i){
vector<int> L;
for(int j = 0; j < m; ++j) L.pb(c(i, j));
rows.pb(add_or(L));
}
vector<int> cols;
for(int j = 0; j < m; ++j){
vector<int> L;
for(int i = 0; i < n; ++i) L.pb(c(i, j));
cols.pb(add_or(L));
}
int xo1 = add_xor(rows);
int xo2 = add_xor(cols);
int xo3 = add_xor({xo1, xo2});
vector<int> L;
for(int j = 0; j + 1 < n; ++j){
L.pb(add_and({rows[j], rows[j + 1]}));
}
for(int j = 0; j + 1 < m; ++j){
L.pb(add_and({cols[j], cols[j + 1]}));
}
int last = add_or(L);
add_and({last, xo3});
}
}
Compilation message (stderr)
vision.cpp: In function 'void construct_network(int, int, int)':
vision.cpp:30:7: warning: unused variable 'c' [-Wunused-variable]
30 | int c = add_or(D);
| ^
# | 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... |