# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
996072 | Muaath_5 | Quality Of Living (IOI10_quality) | C++17 | 39 ms | 76368 KiB |
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;
#define ll long long
#define endl '\n'
#define FF first
#define SS second
#define all(a) a.begin(), a.end()
#define mod (ll)(1000000007)
int rectangle(int rr, int cc, int h, int w, int A[3001][3001]){
int l = 1, r = rr * cc, res;
while (l < r) {
int md = (l + r + 1) / 2;
int mx = 1000000000;
vector<vector<int> > CC(3001, vector<int>(3001));
for (int i = 0; i < rr; i++) {
for (int j = 0; j < cc; j++) {
CC[i][j] = (A[i][j] <= md);
if (i) {
CC[i][j] += CC[i - 1][j];
}
if (j) {
CC[i][j] += CC[i][j - 1];
}
if (rr >= h - 1 && cc >= w - 1) {
int sum = CC[i][j];
if (i - h >= 0) {
sum -= CC[i - h][j];
}
if (j - w >= 0) {
sum -= CC[i][j - w];
}
if (i - h >= 0 || j - w >= 0) {
sum += CC[i - h][j - w];
}
mx = max(mx, sum);
}
}
}
if (mx >= h * w / 2) {
res = md, r = md - 1;
}
else {
l = md;
}
}
return res;
}
Compilation message (stderr)
# | 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... |