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;
vector<int>r,c;
vector<int>ans;
int zero;
void pe(int x){
for(int i=0;i<9;i++){
int val=add_xor({ans[i],x});
int car=add_and({ans[i],x});
ans[i]=val;
x=car;
}
}
void construct_network(int h, int w, int k) {
int i,j;
zero=add_and({0,add_not(0)});
for(i=0;i<h;i++){
vector<int>v;
for(j=0;j<w;j++)v.push_back(i*w+j);
r.push_back(add_xor(v));
}
for(i=0;i<w;i++){
vector<int>v;
for(j=0;j<h;j++)v.push_back(j*w+i);
c.push_back(add_xor(v));
}
ans.resize(9,zero);
pe(r[0]),pe(c[0]);
for(i=1;i<h;i++)r[i]=add_xor({r[i-1],r[i]}),pe(r[i]);
for(i=1;i<w;i++)c[i]=add_xor({c[i-1],c[i]}),pe(c[i]);
for(i=0;i<9;i++)if(!((k>>i)&1))ans[i]=add_not(ans[i]);
add_and(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... |