Submission #519632

#TimeUsernameProblemLanguageResultExecution timeMemory
519632drkarlicio2107Quality Of Living (IOI10_quality)C++14
0 / 100
1 ms588 KiB
#include <bits/stdc++.h> int pref [3010][3010]; int l [3001][3001]; int rectangle(int R, int C, int H, int W, int Q[3001][3001]){ int lo=0, hi=R*C; for (int i=0; i<R; i++){ for (int j=0; j<C; j++) l [i+1][j+1]=Q[i][j]; } while(lo<hi){ int mid=(lo+hi+1)/2; long long int ans=1e9; int da=0; for (int i=1; i<R+1; i++){ for (int j=1; j<C+1; j++){ if(l[i][j]<mid) l[i][j]=-1; if(l[i][j]>mid) l[i][j]=1; pref[i][j]=pref[i-1][j]+pref[i][j-1]-pref[i-1][j-1]+l[i][j]; if(i>=H && j>=W) if (pref[i][j]-pref[i-H][j]-pref[i][j-W]+pref[i-H][j-W]<0) da=1; } } if(da) hi=mid-1; else lo=mid; } return lo; }

Compilation message (stderr)

quality.cpp: In function 'int rectangle(int, int, int, int, int (*)[3001])':
quality.cpp:10:17: warning: unused variable 'ans' [-Wunused-variable]
   10 |   long long int ans=1e9;
      |                 ^~~
#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...