# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
357591 | Mefarnis | Quality Of Living (IOI10_quality) | C++14 | 5099 ms | 35692 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"
#include "grader.h"
#define maxn 3001
using namespace std;
int sum[maxn][maxn];
int rectangle(int n, int m, int h, int w, int ar[3001][3001]) {
int N = n*m , ans;
int l = 1 , r = N;
while(l <= r) {
int mid = (l+r) >> 1;
memset(sum,0,sizeof(sum));
for( int i = 1 ; i <= n ; i++ )
for( int j = 1 ; j <= m ; j++ ) {
int add = (ar[i-1][j-1] >= mid) ? +1 : -1;
sum[i][j] = sum[i-1][j] + sum[i][j-1] - sum[i-1][j-1] + add;
}
bool ok = false;
for( int r = h ; r <= n ; r++ )
for( int c = w ; c <= m ; c++ ) {
int total = sum[r][c] - sum[r-h][c] - sum[r][c-w] + sum[r-h][c-w];
if(total > 0)
ok = true;
}
if(ok)
ans = mid , r = mid-1;
else
l = mid+1;
}
}
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... |