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>
using namespace std;
int pref [3010][3010]; int l [3001][3001];
int rectangle(int R, int C, int H, int W, int Q[3001][3001]){
int lo=0, hi=R*C;
while(lo<hi){
//cout << lo << " " << hi << endl;
int mid=(lo+hi+1)/2;
int da=0;
for (int i=1; i<R+1; i++){
for (int j=1; j<C+1; j++){
if(Q[i-1][j-1]<mid) l[i][j]=-1;
else if(Q[i-1][j-1]>mid) l[i][j]=1;
else l[i][j]=0;
pref[i][j]=pref[i-1][j]+pref[i][j-1]-pref[i-1][j-1]+l[i][j];
if(i>=H && j>=W) if (pref[i][j]-pref[i-H][j]-pref[i][j-W]+pref[i-H][j-W]<0) da=1;
//cout << pref[i][j] << "x" << l[i][j] << " ";
}
//cout << endl;
}
if(da) hi=mid-1;
else lo=mid;
}
return lo;
}
# | 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... |