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

#TimeUsernameProblemLanguageResultExecution timeMemory
1105584andrewpQuality Of Living (IOI10_quality)C++14
Compilation error
0 ms0 KiB
#include "quality.h" #include<bits/stdc++.h> using namespace std; int rectangle(int n, int m, int H, int W, int A[3001][3001]){ int a[n+10][m+10]; for(int i=1;i<=n;i++) for(int j=1;j<=m;j++) a[i][j]=A[i-1][j-1]; int bot=1,top=n*m,ans; while(bot<=top){ int mid=bot+top>>1; int ps[n+10][m+10]; for(int i=0;i<n+10;i++) for(int j=0;j<m+10;j++) ps[i][j]=0; for(int i=1;i<=n;i++){ for(int j=1;j<=m;j++){ ps[i][j]=ps[i-1][j]+ps[i][j-1]-ps[i-1][j-1]; if(A[i][j]>mid) ps[i][j]++; } } int val=m*n+50; for(int i=1;i<=n;i++){ for(int j=1;j<=m;j++){ if(i<H||j<W) continue; val=min(val,ps[i][j]-ps[i-H][j]-ps[i][j-W]+ps[i-H][j-W]); } } if(val<=H*W/2){ res=mid; top=mid-1; } else bot=mid+1; } return ans; }

Compilation message (stderr)

quality.cpp: In function 'int rectangle(int, int, int, int, int (*)[3001])':
quality.cpp:9:20: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
    9 |         int mid=bot+top>>1;
      |                 ~~~^~~~
quality.cpp:26:13: error: 'res' was not declared in this scope
   26 |             res=mid;
      |             ^~~