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"
int rectangle(int R, int C, int H, int W, int Q[3001][3001]) {
static int sum[3001][3001] = {};
int ok = R * C, ng = 0;
while (ok - ng > 1) {
const auto md = (ok + ng) / 2;
for (int i = 0; i < R; ++i) {
for (int j = 0; j < C; ++j) {
sum[i + 1][j + 1] = sum[i + 1][j] + sum[i][j + 1] - sum[i][j] + (Q[i][j] <= md);
}
}
bool f = false;
for (int i = H; !f and i <= R; ++i) {
for (int j = W; !f and j <= C; ++j) {
if (sum[i][j] - sum[i - H][j] - sum[i][j - W] + sum[i - H][j - W] > H * W / 2) {
f = true;
}
}
}
if (f) {
ok = md;
} else {
ng = md;
}
}
return ok;
}
# | 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... |