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 "quality.h"
int a,b,c,d,e,i,j,ii,jj,zx,xc,lef,rig,mid,f[3005][3005],H,W,jm[3005][3005],E;
int rectangle(int RR, int CC, int HH, int WW, int QQ[3001][3001]) {
a=RR;b=CC;
H=HH;W=WW;
for(i=1; i<=a; i++){
for(j=1; j<=b; j++){
f[i][j]=QQ[i-1][j-1];
}
}
lef=0;rig=a*b+1;
while(1){
if(lef+1>=rig) break;
mid=(lef+rig)/2;
for(i=1; i<=a; i++){
for(j=1; j<=b; j++){
if(f[i][j]<=mid){
jm[i][j]=1;
}else{
jm[i][j]=0;
}
}
}
for(i=1; i<=a; i++){
for(j=1; j<=b; j++){
jm[i][j]+=jm[i-1][j]+jm[i][j-1]-jm[i-1][j-1];
}
}
E=0;
for(i=H; i<=a; i++){
for(j=W; j<=b; j++){
zx=jm[i][j]-jm[i-H][j]-jm[i][j-W]+jm[i-H][j-W];
xc=(H*W)/2+1;
if(zx>=xc) E=1;
}
}
if(E==1){
rig=mid;
}else{
lef=mid;
}
}
return rig;
}
# | 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... |