Submission #925507

#TimeUsernameProblemLanguageResultExecution timeMemory
925507VMaksimoski008Quality Of Living (IOI10_quality)C++14
0 / 100
17 ms37724 KiB
#include <iostream> #include "quality.h" using namespace std; int rectangle(int n, int m, int h, int w, int q[3001][3001]) { int l=(n*m+1)/2, r=n*m, ans=0, pref[3001][3001]; while(l <= r) { int M = (l + r) / 2; bool ok = 0; for(int i=1; i<=n; i++) for(int j=1; j<=m; j++) pref[i][j] = (q[i-1][j-1] <= M) + pref[i-1][j] + pref[i][j-1] - pref[i-1][j-1]; for(int i=1; i+h-1<=n; i++) for(int j=1; j+w-1<=m; j++) if(2 * (pref[i+h-1][j+w-1] - pref[i-1][j+w-1] - pref[i+h-1][j-1] + pref[i-1][j-1]) >= h * w) ok = 1; if(ok) ans = M, r = M - 1; else l = M + 1; } 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...