#include <bits/stdc++.h>
#include "quality.h"
using namespace std;
int pref[3001][3001];
int rectangle(int n, int m, int h, int w, int q[3001][3001]) {
int l=0, r=24, ans = 0;
while(l <= r) {
int mid = (l + r) / 2;
bool ok = 0;
memset(pref, 0, sizeof(pref));
for(int i=1; i<=n; i++)
for(int j=1; j<=m; j++)
pref[i][j] = (q[i-1][j-1] <= mid) + pref[i-1][j] + pref[i][j-1] - pref[i-1][j-1];
for(int i=1; i+h-1<=n; i++)
for(int j=1; j+w-1<=m; j++)
if(2ll * (pref[i+h-1][j+w-1] - pref[i-1][j+w-1] - pref[i+h-1][j-1] + pref[i-1][j-1]) >= 1ll * h * w) ok = 1;
if(ok) ans = mid, r = mid - 1;
else l = mid + 1;
}
return ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
19 ms |
37464 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
19 ms |
37464 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
19 ms |
37464 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
19 ms |
37464 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
19 ms |
37464 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |