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

#TimeUsernameProblemLanguageResultExecution timeMemory
331281joseacazQuality Of Living (IOI10_quality)C++17
100 / 100
2483 ms140424 KiB
#include "quality.h" #include <bits/stdc++.h> using namespace std; using ll = long long; using pii = pair<int, int>; using pll = pair<ll, ll>; const int MAXN = 3005; int pre[MAXN][MAXN]; int sum(int x1, int y1, int x2, int y2) { return pre[x2][y2] - pre[x1 - 1][y2] - pre[x2][y1 - 1] + pre[x1 - 1][y1 - 1]; } int rectangle(int R, int C, int H, int W, int Q[3001][3001]) { int s = 1, e = R*C, mid, val, ans = 1; while(s <= e) { mid = (s + e) / 2; for(int i = 0; i < R; i++) for(int j = 0; j < C; j++) pre[i + 1][j + 1] = (Q[i][j] <= mid); for(int i = 1; i <= R; i++) for(int j = 1; j <= C; j++) pre[i][j] += pre[i - 1][j] + pre[i][j - 1] - pre[i - 1][j - 1]; val = 0; for(int i = H; i <= R; i++) for(int j = W; j <= C; j++) if(sum(i - H + 1, j - W + 1, i, j) > H*W/2) val = 1; if(val) { ans = mid; e = mid - 1; } else s = mid + 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...