#include "quality.h"
#include <bits/stdc++.h>
using namespace std;
int rectangle(int n, int m, int h, int w, int vect[3001][3001]){
	int low=0, high=n*m;
	while (low+1<high){
		int mid=(low+high)/2, mx=0;
		vector<vector<int> > psum(n+1, vector<int>(m+1, 0));
		for (int i=1; i<=n; ++i)for (int j=1; j<=m; ++j)psum[i][j]=psum[i][j-1]+(vect[i-1][j-1]<mid);
		for (int j=1; j<=m; ++j)for (int i=1; i<=n; ++i)psum[i][j]+=psum[i-1][j];
		for (int i=h; i<=n; ++i)for (int j=w; j<=m; ++j)mx=max(mx, psum[i][j]-psum[i-h][j]-psum[i][j-w]+psum[i-h][j-w]);
		if (mx>=h*w/2)high=mid;
		else low=mid;
	}
	return high;
}
| # | 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... |