# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
283567 | tinjyu | Quality Of Living (IOI10_quality) | C++14 | 3687 ms | 246216 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 "quality.h"
#include <iostream>
using namespace std;
long long int h,w,r,c,sum[3005][3005],a[3005][3005];
bool check(){
for(int i=0;i<r;i++)
{
for(int j=0;j<c;j++)
{
sum[i][j]=a[i][j];
if(i>0)sum[i][j]+=sum[i-1][j];
if(j>0)sum[i][j]+=sum[i][j-1];
if(i>0 && j>0)sum[i][j]-=sum[i-1][j-1];
//cout<<sum[i][j]<<" ";
}
//cout<<endl;
}
for(int i=h-1;i<r;i++)
{
for(int j=w-1;j<c;j++)
{
int now=sum[i][j];
if(i-h>=0)now-=sum[i-h][j];
if(j-w>=0)now-=sum[i][j-w];
if(i-h>=0 && j-w>=0)now+=sum[i-h][j-w];
//cout<<i<<" "<<j<<" "<<now<<endl;
if(now<=0)return 1;
}
}
return 0;
}
int rectangle(int R, int C, int H, int W, int Q[3001][3001]) {
long long int ans,le=1,ri=R*C;
h=H;
w=W;
r=R;
c=C;
while(le<=ri)
{
int mid=(le+ri)/2;
//cout<<mid<<endl;
for(int i=0;i<R;i++)
{
for(int j=0;j<C;j++)
{
if(Q[i][j]<mid)a[i][j]=-1;
if(Q[i][j]==mid)a[i][j]=0;
if(Q[i][j]>mid)a[i][j]=1;
//cout<<a[i][j]<<" ";
}
//cout<<endl;
}
if(check()==1)
{
ans=mid;
ri=mid-1;
}
else le=mid+1;
}
return ans;
}
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... |