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>
#include "vision.h"
//~ #include "grader.cpp"
using namespace std;
int H, W, K;
vector <int> kb(9);
int id(int i, int j){
return i * W + j;
}
void add(int c){
for(auto &i : kb){
int old = i;
i = add_xor({c, i});
c = add_and({c, old});
}
}
void construct_network(int h, int w, int k) {
H = h; W = w; K = k;
if(H * W == 2){
add_or({0});
return;
}
int zero = add_and({0, 1, 2});
int one = add_not(zero);
for(auto &i : kb){
i = add_not(one);
}
int c = add_not(one);
for(int i = 0 ; i < H ; i++){
vector <int> Ns;
Ns.push_back(c);
for(int j = 0 ; j < W ; j++){
Ns.push_back(id(i, j));
}
c = add_xor(Ns);
add(c);
}
for(int j = 0 ; j < W ; j++){
vector <int> Ns;
Ns.push_back(c);
for(int i = 0 ; i < H ; i++){
Ns.push_back(id(i, j));
}
c = add_xor(Ns);
add(c);
}
vector <int> f;
for(int i = 0 ; i < 9 ; i++){
int cur;
if((k >> i) & 1) cur = one;
else cur = zero;
cur = add_xor({cur, kb[i]});
cur = add_not(cur);
f.push_back(cur);
}
add_and(f);
}
# | 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... |