제출 #927317

#제출 시각아이디문제언어결과실행 시간메모리
927317VMaksimoski008삶의 질 (IOI10_quality)C++14
100 / 100
1140 ms140364 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=(h*w+1)/2, r=n*m-(h*w)/2, A=0, P[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++) P[i][j] = (q[i-1][j-1] <= M) + P[i-1][j] + P[i][j-1] - P[i-1][j-1]; for(int i=1; i+h-1<=n; i++) for(int j=1; j+w-1<=m; j++) if(2 * (P[i+h-1][j+w-1] - P[i-1][j+w-1] - P[i+h-1][j-1] + P[i-1][j-1]) >= h * w) ok = 1; if(ok) A = M, r = M - 1; else l = M + 1; } return A; }
#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...