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;
int n,m;
int porsor(int l1,int l2,int r1,int r2){
vector<int>por;
for(int i=0;i<n;i++){
for(int j=0;j<m;j++){
if(i>=l1&&i<=l2&&j>=r1&&j<=r2){
por.push_back(i*n+j);
}
}
}
return add_or(por);
}
int porsxor(int l1,int l2,int r1,int r2){
vector<int>por;
for(int i=0;i<n;i++){
for(int j=0;j<m;j++){
if(i>=l1&&i<=l2&&j>=r1&&j<=r2){
por.push_back(i*n+j);
}
}
}
return add_xor(por);
}
void construct_network(int H, int W, int K) {
n=H;
m=W;
std::vector<int> Ns;
int low=-1,high=W-1,mid,l1,r1,l2,r2;
while(high-low>1){
mid=(high+low)>>1;
int x=porsor(0,H-1,low+1,mid);
if(x==1){
high=mid;
}else{
low=mid;
}
}
l1=high;
low=-1,high=H-1;
while(high-low>1){
mid=(high+low)>>1;
int x=porsor(low+1,mid,0,W-1);
if(x==1){
high=mid;
}else{
low=mid;
}
}
r1=high;
low=-1,high=W-1;
while(high-low>1){
mid=(high+low)>>1;
int x=porsxor(0,H-1,low+1,mid);
if(l1<=mid&&l1>=low+1){
x^=1;
}
if(x==1){
high=mid;
}else{
low=mid;
}
}
l2=high;
low=-1,high=H-1;
while(high-low>1){
mid=(high+low)>>1;
int x=porsxor(low+1,mid,0,W-1);
if(r1<=mid&&r1>=low+1){
x^=1;
}
if(x==1){
high=mid;
}else{
low=mid;
}
}
r2=high;
if(abs(r2-r1)+abs(l1-l2)==K){
int x=add_not(0);
if(x==0){
add_or({0});
}
}else{
int x=add_not(0);
if(x==1){
add_or({0});
}
}
}
# | 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... |