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;
typedef long long ll;
typedef long double ld;
#define rep(a, b) for(int a = 0; a < (b); ++a)
#define st first
#define nd second
#define pb push_back
#define all(a) a.begin(), a.end()
const int LIM=3e3+7;
int sum[LIM][LIM];
int rectangle(int R, int C, int H, int W, int Q[3001][3001]) {
int p=1, k=R*C;
while(p<k) {
int sr=(p+k)/2;
rep(i, R) rep(j, C) {
sum[i+1][j+1]=sum[i+1][j]+sum[i][j+1]-sum[i][j];
if(Q[i][j]<=sr) ++sum[i+1][j+1];
}
int ma=0;
for(int i=H; i<=R; ++i) for(int j=W; j<=C; ++j) {
ma=max(ma, sum[i][j]-sum[i-H][j]-sum[i][j-W]+sum[i-H][j-W]);
}
if(ma<(H*W+1)/2) p=sr+1; else k=sr;
}
return p;
}
# | 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... |