Submission #229123

#TimeUsernameProblemLanguageResultExecution timeMemory
229123thtsshz_bgwrswhQuality Of Living (IOI10_quality)C++17
0 / 100
5 ms640 KiB
#pragma GCC optimize("Ofast") #include "grader.h" #include "quality.h" #include<stdio.h> #include<algorithm> using namespace std; int r,c,h,w,num[3005][3005],pre[3005][3005]; bool check(int v){ int i,j; for(i=0;i<r;i++){ for(j=0;j<c;j++){ if(num[i][j]>v) pre[i][j]=1; else if(num[i][j]==v) pre[i][j]=0; else pre[i][j]=-1; } } for(i=0;i<r;i++) for(j=0;j<c;j++) pre[i][j]+=((i&&j)?pre[i-1][j-1]:0)-(j?pre[i][j-1]:0)-(i?pre[i-1][j]:0); for(i=0;i<=r-h;i++) for(j=0;j<=c-w;j++) if(pre[i+h-1][j+c-1]+((i&&j)?pre[i-1][j-1]:0)-(j?pre[i][j-1]:0)-(i?pre[i-1][j]:0)>=0) return 1; return 0; } int rectangle(int R,int C,int H,int W,int Q[3001][3001]){ r=R; c=C; h=H; w=W; int i,j,right=r*c+1,left=0; for(i=0;i<r;i++) for(j=0;j<c;j++) num[i][j]=Q[i][j]; while(right-left>1){ int mid=(right+left)>>1; if(check(mid)) right=mid; else left=mid; } return right; }
#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...