(UPD: 2024-12-04 14:48 UTC) Judge is not working due to Cloudflare incident. (URL) We can do nothing about it, sorry. After the incident is resolved, we will grade all submissions.

Submission #283567

#TimeUsernameProblemLanguageResultExecution timeMemory
283567tinjyuQuality Of Living (IOI10_quality)C++14
100 / 100
3687 ms246216 KiB
#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)

quality.cpp: In function 'int rectangle(int, int, int, int, int (*)[3001])':
quality.cpp:63:9: warning: 'ans' may be used uninitialized in this function [-Wmaybe-uninitialized]
   63 |  return ans;
      |         ^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...