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;
const int nx=3e3+5;
int qs[nx][nx], l, r;
int rectangle(int R, int C, int H, int W, int Q[3001][3001]) {
l=1, r=R*C;
while (l<r)
{
int md=(l+r)/2, mx=0;
for (int i=1; i<=R; i++) for (int j=1; j<=C; j++) qs[i][j]=(Q[i-1][j-1]<=md), qs[i][j]+=qs[i-1][j]+qs[i][j-1]-qs[i-1][j-1];
for (int i=H; i<=R; i++) for (int j=W; j<=C; j++) mx=max(mx, qs[i][j]-qs[i-H][j]-qs[i][j-W]+qs[i-H][j-W]);
if (mx>=(H*W+1)/2) r=md;
else l=md+1;
}
return l;
}
# | 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... |