Submission #943471

#TimeUsernameProblemLanguageResultExecution timeMemory
943471IBoryQuality Of Living (IOI10_quality)C++17
0 / 100
1 ms4440 KiB
#include <bits/stdc++.h> using namespace std; const int MAX = 3001; int Y[MAX * MAX], X[MAX * MAX]; int rectangle(int R, int C, int H, int W, int S[MAX][MAX]) { for (int i = 0; i < R; ++i) for (int j = 0; j < C; ++j) { int n = S[i][j]; Y[n] = i, X[n] = j; } int l = 0, r = R * C + 1; while (l + 1 < r) { int mid = (l + r) >> 1; for (int i = 1; i <= mid; ++i) S[Y[i]][X[i]] = 1; for (int i = mid + 1; i <= R * C; ++i) S[Y[i]][X[i]] = 0; for (int i = 0; i < R; ++i) for (int j = 1; j < C; ++j) S[i][j] += S[i][j - 1]; for (int j = 0; j < C; ++j) for (int i = 1; i < R; ++i) S[i][j] += S[i - 1][j]; int high = 0; for (int i = H - 1; i < R; ++i) for (int j = W - 1; j < C; ++j) { int s = S[i][j] - (i <= H ? S[i - H][j] : 0) - (j <= W ? S[i][j - W] : 0) + (i <= H && j <= W ? S[i - H][j - W] : 0); high = max(high, s); } ((H * W + 1) / 2 <= high ? r : l) = mid; } return r; }
#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...