Submission #401982

#TimeUsernameProblemLanguageResultExecution timeMemory
401982IloveNQuality Of Living (IOI10_quality)C++14
0 / 100
1 ms460 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 >= (R * C + 1) / 2) ans = mid, l = mid + 1; else r = mid - 1; } return ans; } /*int main() { //freopen("ss.inp", "r", stdin); ios::sync_with_stdio(false); cin.tie(0); 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...