Submission #934849

# Submission time Handle Problem Language Result Execution time Memory
934849 2024-02-28T05:30:11 Z vjudge1 Quality Of Living (IOI10_quality) C++
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
#define faster ios_base::sync_with_stdio(false);cin.tie(NULL);
#define fi first
#define se second
#define pb push_back
//#define task "hetcuu"
using namespace std;
using ll = long long;
using ld = long double;
const int maxN = 3e3 + 1;
int solve(int n ,int m,int h,int w,a[maxN][maxN]){
    faster
    //freopen(task".inp","r",stdin);
    //freopen(task".out","w",stdout);
    //input(r,c,h,w);
    int pre[maxN][maxN];
    //cin >> n >> m >> h >> w;
    //for(int i = 1; i <= n;++i){
    //    for(int j = 1;j <= m;++j){
    //        cin >> a[i][j];
    //    }
    //}
    int l=(h*w+1)/2, r=n*m, ans=0;
    while(l <= r) {
        int mid = (l + r) / 2;
        bool ok = 0;

        for(int i=1; i<=n; i++)
            for(int j=1; j<=m; j++)
                pre[i][j] = (a[i][j] <= mid) + pre[i-1][j] + pre[i][j-1] - pre[i-1][j-1];

        for(int i=1; i+h-1<=n; i++)
            for(int j=1; j+w-1<=m; j++)
                if(2 * (pre[i+h-1][j+w-1] - pre[i-1][j+w-1] - pre[i+h-1][j-1] + pre[i-1][j-1]) >= h * w) ok = 1;

        if(ok) ans = mid, r = mid - 1;
        else l = mid + 1;
    }
    return ans;
}

Compilation message

quality.cpp:11:36: error: 'a' has not been declared
   11 | int solve(int n ,int m,int h,int w,a[maxN][maxN]){
      |                                    ^
quality.cpp: In function 'int solve(int, int, int, int, int (*)[3001])':
quality.cpp:30:30: error: 'a' was not declared in this scope
   30 |                 pre[i][j] = (a[i][j] <= mid) + pre[i-1][j] + pre[i][j-1] - pre[i-1][j-1];
      |                              ^