Submission #934838

# Submission time Handle Problem Language Result Execution time Memory
934838 2024-02-28T05:17:28 Z vjudge1 Quality Of Living (IOI10_quality) C++14
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 m,n,h,w;
int q[maxN][maxN];
int pre[maxN][maxN];
/*void input(int r,int c,int h,int w){
    cin >> r >> c >> h >> w;
    for(int i = 1; i <= r;++i){
        for(int j = 1;j <= c;++j){
            cin >> a[i][j];
        }
    }
}
int init(int r,int c, int h,int w){
    int R = r * c, L = (h * w + 1) / 2;
    while(L < R){
        int mid = (L + R) / 2;
        bool ok = 0;
        for(int i = 1; i <= r;++i){
            for(int j = 1;j <= c;++j){
                pre[i][j] = (a[i - 1][j - 1] <= mid) + pre[i - 1][j] + pre[i][j - 1] - pre[i - 1][j - 1];
                cerr << L << " " << R << "\n";
            }
        }
        for(int i = 1; i + h - 1 <= r;++i){
            for(int j = 1;j + w - 1 <= c;++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;
                cerr << L << " " << R << "\n";
            }
        }
        if(ok){
            ans = mid;
            R = mid - 1;
        }
        else{
            L = mid + 1;
        }
    }
    return ans;
}*/
int main(){
    faster
    //freopen(task".inp","r",stdin);
    //freopen(task".out","w",stdout);
    //input(r,c,h,w);
    cin >> n >> m >> h >> w;
    for(int i = 1; i <= n;++i){
        for(int j = 1;j <= m;++j){
            cin >> q[i][j];
        }
    }
    int l=(h*w+1)/2, r=n*m, ans=0, pref[3001][3001];
    while(l <= r) {
        int M = (l + r) / 2;
        bool ok = 0;

        for(int i=1; i<=n; i++)
            for(int j=1; j<=m; j++)
                pref[i][j] = (q[i][j] <= M) + pref[i-1][j] + pref[i][j-1] - pref[i-1][j-1];

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

        if(ok) ans = M, r = M - 1;
        else l = M + 1;
    }
    cout << ans;
}

Compilation message

/usr/bin/ld: /tmp/ccvqO2Zv.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccKmPQHy.o:quality.cpp:(.text.startup+0x0): first defined here
/usr/bin/ld: /tmp/ccvqO2Zv.o: in function `main':
grader.cpp:(.text.startup+0xe9): undefined reference to `rectangle(int, int, int, int, int (*) [3001])'
collect2: error: ld returned 1 exit status