This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
///~~~LOTA~~~///
#include "quality.h"
#include <bits/stdc++.h>
using namespace std;
int x[3001][3001];
bool check(int r,int c,int h,int w){
for(int i=h;i<=r;i++)
for(int j=w;j<=c;j++)
if((x[i][j]-x[i-h][j]-x[i][j-w]+x[i-h][j-w])>=(h*w+1)/2)
return 1;
return 0;
}
int rectangle(int r,int c,int h,int w,int q[3001][3001]){
int o=log2(r*c);
o=pow(2,o);
int ans=0;
for(o=o;o>0;o/=2){
if(ans+o>r*c) continue;
for(int i=1;i<=r;i++)
for(int j=1;j<=c;j++)
x[i][j]=(q[i-1][j-1]<=ans+o)+x[i-1][j]+x[i][j-1]-x[i-1][j-1];
if(check(r,c,h,w)) ans+=o;
}
return ans;
}
# | 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... |