Submission #401982

# Submission time Handle Problem Language Result Execution time Memory
401982 2021-05-11T06:01:30 Z IloveN Quality Of Living (IOI10_quality) C++14
0 / 100
1 ms 460 KB
#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 time Memory Grader output
1 Incorrect 1 ms 460 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 460 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 460 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 460 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 460 KB Output isn't correct
2 Halted 0 ms 0 KB -