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 <bits/stdc++.h>
using namespace std;
int rectangle(int R, int C, int H, int W, int Q[3001][3001]) {
vector<vector<int>>v(3001,vector<int>(3001));
int l=1,r=R*C,bs;
while(l<r){
bs=(l+r)/2;
bool is=0;
for(int i=1; i<=R; i++)for(int j=1; j<=C; j++)
v[i][j]=v[i-1][j]+v[i][j-1]-v[i-1][j-1]+(Q[i-1][j-1]<=bs);
for(int i=H; i<=R; i++)for(int j=W; j<=C; j++)
is|=(v[i][j]-v[i-H][j]-v[i][j-W]+v[i-H][j-W]>=(H*W+1)/2);
if(!is)l=bs+1;
else r=bs;
}
return r;
}
# | 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... |