제출 #229126

#제출 시각아이디문제언어결과실행 시간메모리
229126thtsshz_bgwrswh삶의 질 (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]+=(j?pre[i][j-1]:0)+(i?pre[i-1][j]:0)-((i&&j)?pre[i-1][j-1]:0); for(i=0;i<=r-h;i++) for(j=0;j<=c-w;j++) if(pre[i+h-1][j+w-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...