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 pb push_back
const int N = 405;
vector<int> rd[N],ld[N],ans,unans;
int r[N],l[N],pl[N],pr[N],an,unan;
void construct_network(int H, int W, int K) {
for(int i=0; i<H; i++){
for(int j=0; j<W; j++){
rd[i+j].pb(i*W+j);
ld[i-j+W-1].pb(i*W+j);
}
}
for(int i=H+W-2; i>=0; i--){
r[i]=add_or(rd[i]);
l[i]=add_or(ld[i]);
if(i==H+W-2){
pl[i]=l[i];
pr[i]=r[i];
}else{
pl[i]=add_or({pl[i+1],l[i]});
pr[i]=add_or({pr[i+1],r[i]});
}
if(i+K<H+W-1){
ans.pb(add_and({l[i],l[i+K]}));
ans.pb(add_and({r[i],r[i+K]}));
}
if(i+K+1<H+W-1){
unans.pb(add_and({l[i],pl[i+K+1]}));
unans.pb(add_and({r[i],pr[i+K+1]}));
}
}
an=add_or(ans);
if(!unans.empty()){
unan=add_not(add_or(unans));
add_and({an,unan});
}
}
# | 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... |