# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
734890 | phoebe | Quality Of Living (IOI10_quality) | C++17 | 1761 ms | 122328 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 <bits/stdc++.h>
#include "quality.h"
using namespace std;
int prefix[3001][3001] = {0};
int rectangle(int R, int C, int H, int W, int Q[3001][3001]){
int l = 0, r = 3001 * 3001, ans;
while (l <= r){
int mid = (l + r) / 2;
for (int i = 1; i <= R; i++){
for (int j = 1; j <= C; j++){
if (Q[i - 1][j - 1] <= mid) prefix[i][j] = 1;
else prefix[i][j] = -1;
prefix[i][j] += prefix[i][j - 1];
}
}
for (int i = 1; i <= R; i++){
for (int j = 1; j <= C; j++)
prefix[i][j] += prefix[i - 1][j];
}
bool pos = false;
for (int i = H; i <= R; i++){
for (int j = W; j <= C; j++){
int val = prefix[i][j] - prefix[i - H][j]
- prefix[i][j - W] + prefix[i - H][j - W];
if (val > 0) pos = true;
}
}
if (pos) ans = mid, r = mid - 1;
else l = mid + 1;
}
return ans;
}
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... |