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

#TimeUsernameProblemLanguageResultExecution timeMemory
761100BlagojQuality Of Living (IOI10_quality)C++17
100 / 100
2764 ms210788 KiB
#include <bits/stdc++.h> #include "quality.h" using namespace std; #define endl '\n' #define ll long long #define all(x) x.begin(), x.end() int h, w, r, c, a[3002][3002], dp[3002][3002]; bool b(int v) { int s = (h * w) / 2 + 1; for (int i = 0; i < r; i++) { int cnt = 0; for (int j = 0; j < c; j++) { if (a[i][j] <= v) cnt++; dp[i][j] = cnt; if (i - 1 >= 0) { dp[i][j] += dp[i - 1][j]; } if (i == h - 1 && j == w - 1) { if (dp[i][j] >= s) return 1; } else if (i == h - 1 && j >= w) { if (dp[i][j] - dp[i][j - w] >= s) return 1; } else if (i >= h && j == w - 1) { if (dp[i][j] - dp[i - h][j] >= s) return 1; } else if (i >= h - 1 && j >= w - 1) { if (dp[i][j] - dp[i - h][j] - dp[i][j - w] + dp[i - h][j - w] >= s) return 1; } } } return 0; } int rectangle(int R, int C, int H, int W, int Q[3001][3001]) { r = R, c = C, h = H, w = W; for (int i = 0; i < r; i++) { for (int j = 0; j < c; j++) { a[i][j] = Q[i][j]; } } vector<int> v; for (int i = 0; i < r; i++) { for (int j = 0; j < c; j++) { cin >> a[i][j]; v.push_back(a[i][j]); } } int l = 0, rr = r * c; sort(all(v)); int ans = INT_MAX; while (l + 1 < rr) { int m = (l + rr) / 2; if (b(v[m])) { ans = min(ans, v[m]); rr = m; } else { l = m; } } if (b(v[0])) ans = v[0]; 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...