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;
void construct_network(int h, int w, int k){
vector<int> ans;
if(k == 1){
vector<int> r(h), c(w);
for(int i = 0; i < h; i++){
vector<int> res;
for(int j = 0; j < w; j++) res.push_back(i * w + j);
r[i] = add_or(res);
}
for(int i = 0; i < w; i++){
vector<int> res;
for(int j = 0; j < h; j++) res.push_back(i * h + j);
c[i] = add_or(res);
}
int xr = add_xor(r), xc = add_xor(c);
for(int i = 0; i < h; i++) ans.push_back(add_and({r[i - 1], r[i], xc}));
for(int i = 0; i < w; i++) ans.push_back(add_and({c[i - 1], c[i], xr}));
}else{
for(int i = 0; i < h; i++){
for(int j = 0; j < w; j++){
vector<int> res;
for(int x = 0; x < h; x++) for(int y = 0; y < w; y++) if(abs(i - x) + abs(j - y) == k) res.push_back(x * w + y);
if(!res.empty()) ans.push_back(add_and({add_or(res), i * w + j}));
}
}
}
add_or(ans);
}
# | 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... |