(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 #287366

#TimeUsernameProblemLanguageResultExecution timeMemory
287366NamnamseoQuality Of Living (IOI10_quality)C++17
100 / 100
2448 ms135180 KiB
int n,m; int p,q; int (*data)[3001]; int small[3010][3010]; int big [3010][3010]; inline int get(int array[][3010],int x,int y){ return array[x][y]-array[x][y-q]-array[x-p][y]+array[x-p][y-q]; } bool test(int x){ int i,j; for(i=1;i<=n;++i) for(j=1;j<=m;++j){ small[i][j]=small[i][j-1]+small[i-1][j]-small[i-1][j-1]+(data[i-1][j-1]<x); big [i][j]=big [i][j-1]+big [i-1][j]-big [i-1][j-1]+(data[i-1][j-1]>x); } for(i=p;i<=n;++i) for(j=q;j<=m;++j){ if(get(small,i,j)>=get(big,i,j)) { return true; } } return false; } int rectangle(int R, int C, int H, int W, int Q[3001][3001]) { n = R; m = C; p = H; q = W; data = Q; int i,j; i=p*q/2; j=n*m+1; int mid; while(i+1<j){ mid=(i+j)/2; (test(mid)?j:i)=mid; } return j; }
#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...