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 <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using ull = unsigned long long;
constexpr bool typetest = 0;
constexpr int N = 4e5 + 2;
//#include "grader.h"
//#include "quality.h"
int b[3001][3001];
int rectangle(int m, int n, int h, int w, int a[3001][3001])
{
auto Check = [&](int v)
{
for (int i = 1; i <= m; ++i)
for (int j = 1; j <= n; ++j)
b[i][j] = (a[i - 1][j - 1] >= v) + b[i - 1][j] + b[i][j - 1] - b[i - 1][j - 1];
for (int i = h; i <= m; ++i)
for (int j = w; j <= n; ++j)
if ((b[i][j] - b[i - h][j] - b[i][j - w] + b[i - h][j - w]) < (h * w + 1) / 2)
return false;
return true;
};
int l = 1, mid, r = m * n;
while (l <= r)
{
mid = (l + r) / 2;
if (Check(mid))
l = mid + 1;
else
r = mid - 1;
}
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... |