Submission #1130339

#TimeUsernameProblemLanguageResultExecution timeMemory
1130339bachnvQuality Of Living (IOI10_quality)C++20
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
ll n, m, h, w, x, pfs[3005][3005], q[3005][3005];
ll cmp(ll temp){
    if(temp == x){
        return 0;
    }
    else if(temp < x){
        return 1;
    }
    else{
        return -1;
    }
}
bool check(){
    memset(pfs, 0, sizeof(pfs));
    for(int i = 0; i < n; i++){
        for(int j = 0; j < m; j++){
            pfs[i][j] = cmp(q[i][j]);
            if(i){
                pfs[i][j] += pfs[i - 1][j];
            }
            if(j){
                pfs[i][j] += pfs[i][j - 1];
            }
            if(i && j){
                pfs[i][j] -= pfs[i - 1][j - 1];
            }
        }
    }
    for(int i = 0; i + h - 1 < n; i++){
        for(int j = 0; j + w - 1 < m; j++){
            ll temp = pfs[i + h - 1][j + w - 1];
            if(i){
                temp -= pfs[i - 1][j + w - 1];
            }
            if(j){
                temp -= pfs[i + h - 1][j - 1];
            }
            if(i && j){
                temp += pfs[i - 1][j - 1];
            }
            if(temp >= 0){
                return true;
            }
        }
    }
    return false;
}
int rectangle(ll R, ll C, ll H, ll W, ll Q[3005][3005]){
    n = r, m = c, h = H, w = W;
    for(int i = 0; i < n; i++){
        for(int j = 0; j < m; j++){
            q[i][j] = Q[i][j];
        }
    }
    ll res;
    ll l = 1, r = n * m;
    while(l <= r){
        x = (l + r) / 2;
        if(check()){
            res = x;
            r = x - 1;
        }
        else{
            l = x + 1;
        }
    }
    return res;
}

Compilation message (stderr)

quality.cpp: In function 'int rectangle(ll, ll, ll, ll, ll (*)[3005])':
quality.cpp:52:9: error: 'r' was not declared in this scope
   52 |     n = r, m = c, h = H, w = W;
      |         ^
quality.cpp:52:16: error: 'c' was not declared in this scope
   52 |     n = r, m = c, h = H, w = W;
      |                ^