이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
bool check(int n, int m, int h, int w, int ms[3001][3001], int mid) {
	vector<vector<int>> cnt(n + 1, vector<int>(m + 1));
	for (int i = 1; i <= n; ++i)
		for (int j = 1; j <= m; ++j) {
			int val = ms[i-1][j-1] <= mid;
			cnt[i][j] = cnt[i][j-1] + cnt[i-1][j] - cnt[i-1][j-1] + val;
		}
	for (int i = h; i <= n; ++i)
		for (int j = w; j <= m; ++j)
			if (cnt[i][j] - cnt[i - h][j] - cnt[i][j - w] + cnt[i - h][j - w] > h*w/2) return true;
	return false;
}
int rectangle(int n, int m, int h, int w, int ms[3001][3001]) {
	int l = 1, r = n*m;
	while (l < r) {
		int mid = (l + r)/2;
		if (check(n, m, h, w, ms, mid)) r = mid;
		else l = mid + 1;
	}
	return l;
}
| # | 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... |