#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;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
596 KB |
Output is correct |
2 |
Correct |
1 ms |
596 KB |
Output is correct |
3 |
Correct |
1 ms |
596 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
596 KB |
Output is correct |
2 |
Correct |
1 ms |
596 KB |
Output is correct |
3 |
Correct |
1 ms |
596 KB |
Output is correct |
4 |
Correct |
2 ms |
1620 KB |
Output is correct |
5 |
Correct |
2 ms |
1620 KB |
Output is correct |
6 |
Correct |
3 ms |
1620 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
596 KB |
Output is correct |
2 |
Correct |
1 ms |
596 KB |
Output is correct |
3 |
Correct |
1 ms |
596 KB |
Output is correct |
4 |
Correct |
2 ms |
1620 KB |
Output is correct |
5 |
Correct |
2 ms |
1620 KB |
Output is correct |
6 |
Correct |
3 ms |
1620 KB |
Output is correct |
7 |
Correct |
16 ms |
5460 KB |
Output is correct |
8 |
Correct |
16 ms |
5512 KB |
Output is correct |
9 |
Correct |
16 ms |
5336 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
596 KB |
Output is correct |
2 |
Correct |
1 ms |
596 KB |
Output is correct |
3 |
Correct |
1 ms |
596 KB |
Output is correct |
4 |
Correct |
2 ms |
1620 KB |
Output is correct |
5 |
Correct |
2 ms |
1620 KB |
Output is correct |
6 |
Correct |
3 ms |
1620 KB |
Output is correct |
7 |
Correct |
16 ms |
5460 KB |
Output is correct |
8 |
Correct |
16 ms |
5512 KB |
Output is correct |
9 |
Correct |
16 ms |
5336 KB |
Output is correct |
10 |
Correct |
176 ms |
30820 KB |
Output is correct |
11 |
Correct |
178 ms |
30844 KB |
Output is correct |
12 |
Correct |
104 ms |
21452 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
596 KB |
Output is correct |
2 |
Correct |
1 ms |
596 KB |
Output is correct |
3 |
Correct |
1 ms |
596 KB |
Output is correct |
4 |
Correct |
2 ms |
1620 KB |
Output is correct |
5 |
Correct |
2 ms |
1620 KB |
Output is correct |
6 |
Correct |
3 ms |
1620 KB |
Output is correct |
7 |
Correct |
16 ms |
5460 KB |
Output is correct |
8 |
Correct |
16 ms |
5512 KB |
Output is correct |
9 |
Correct |
16 ms |
5336 KB |
Output is correct |
10 |
Correct |
176 ms |
30820 KB |
Output is correct |
11 |
Correct |
178 ms |
30844 KB |
Output is correct |
12 |
Correct |
104 ms |
21452 KB |
Output is correct |
13 |
Correct |
1663 ms |
175488 KB |
Output is correct |
14 |
Correct |
1683 ms |
175488 KB |
Output is correct |
15 |
Correct |
1564 ms |
168440 KB |
Output is correct |