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

#TimeUsernameProblemLanguageResultExecution timeMemory
401984IloveNQuality Of Living (IOI10_quality)C++14
100 / 100
2085 ms140284 KiB
#include<bits/stdc++.h> #include "quality.h" using namespace std; #define ll long long #define pii pair<int,int> #define pll pair<ll,ll> #define fi first #define se second #define mp make_pair #define pb push_back #define eb emplace_back #define all(vr) vr.begin(),vr.end() #define vi vector<int> #define vll vector<ll> const int N = 3e3 + 10; int ps[N][N]; int rectangle(int R, int C, int H, int W, int Q[3001][3001]) { int l = 1, r = R * C, ans = 0; while (l <= r) { int mid = (l + r) / 2; for (int i = 1; i <= R; ++i) for (int j = 1; j <= C; ++j) ps[i][j] = ps[i - 1][j] + ps[i][j - 1] - ps[i - 1][j - 1] + (Q[i - 1][j - 1] <= mid); int mx = 0; for (int i = 1; i <= R - H + 1; ++i) for (int j = 1; j <= C - W + 1; ++j) mx = max(mx, ps[i + H - 1][j + W - 1] - ps[i + H - 1][j - 1] - ps[i - 1][j + W - 1] + ps[i - 1][j - 1]); if (mx >= (H * W + 1) / 2) ans = mid, r = mid - 1; else l = mid + 1; } return ans; } /*int a[3001][3001]; int main() { freopen("ss.inp", "r", stdin); ios::sync_with_stdio(false); cin.tie(0); int m, n, h, w; cin >> m >> n >> h >> w; for (int i = 0; i < m; ++i) for (int j = 0; j < n; ++j) cin >> a[i][j]; cout << rectangle(m, n, h, w, a); return 0; }*/
#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...