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

#TimeUsernameProblemLanguageResultExecution timeMemory
1105585andrewpQuality Of Living (IOI10_quality)C++14
0 / 100
1 ms2384 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){ ans=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:5:9: warning: variable 'a' set but not used [-Wunused-but-set-variable]
    5 |     int a[n+10][m+10];
      |         ^
quality.cpp:31:12: warning: 'ans' may be used uninitialized in this function [-Wmaybe-uninitialized]
   31 |     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...