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){
//find_nums
vector<int> xorh(H);
for(int i=0; i<H; i++){
vector<int> ns;
for(int j=0; j<W; j++){
ns.push_back(i*W + j);
}
xorh[i] = add_xor(ns);
}
for(int i=1; i<H; i++){
xorh[i] = add_xor({xorh[i], xorh[i-1]});
}
vector<int> bitsh(20);
for(int i=0; i<20; i++){
bitsh[i] = add_xor(xorh);
for(int j=0; j<H; j++){
if((j>>i)%2==0){
xorh[i] = add_xor({xorh[i], xorh[i]});
}
}
}
vector<int> xorw(W);
for(int i=0; i<W; i++){
vector<int> ns;
for(int j=0; j<H; j++){
ns.push_back(j*W + i);
}
xorw[i] = add_xor(ns);
}
for(int i=1; i<W; i++){
xorw[i] = add_xor({xorw[i-1], xorw[i]});
}
vector<int> bitsw(20);
for(int i=0; i<20; i++){
bitsw[i] = add_xor(xorw);
for(int j=0; j<W; j++){
if((j>>i)%2==0){
xorw[j] = add_xor({xorw[j], xorw[j]});
}
}
}
// add
vector<int> bits;
int carry=xorw[0];
for(int i=0; i<20; i++){
bits[i] = add_xor({bitsw[i], bitsh[i], carry});
carry = add_or({add_and({bitsw[i], bitsh[i]}), add_and({bitsw[i], carry}), add_and({bitsh[i], carry})});
}
// compare
vector<int> bitsk(20);
for(int i=0; i<20; i++){
bitsk[i] = (K>>i)%2;
}
vector<int> same(20);
for(int i=0; i<20; i++){
same[i] = add_not(add_xor({bits[i], bitsk[i]}));
}
add_and(same);
}
# | 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... |