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 "quality.h"
#include <iostream>
int rectangle(int R, int C, int H, int W, int Q[3001][3001]) {
int l=1,r=R*C,kq=0,S[R][C];
while (l<=r){
int mid=(l+r)>>1,ch=0;
for (int i=0;i<R;i++)
for (int j=0;j<C;j++){
S[i][j]=(i?S[i-1][j]:0)+(j?S[i][j-1]:0)-(i&&j?S[i-1][j-1]:0)+(Q[i][j]<mid)-(Q[i][j]>mid);
if (i>=H-1&&j>=W-1&&S[i][j]-(i<H?0:S[i-H][j])-(j<W?0:S[i][j-W])+(i<H||j<W?0:S[i-H][j-W])>=0)
ch=1;
}
if (ch){
kq=mid;
r=mid-1;
}
else
l=mid+1;
}
return kq;
}
# | 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... |