Submission #1130338

#TimeUsernameProblemLanguageResultExecution timeMemory
1130338bachnvQuality 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 main(){
    cin >> n >> m >> h >> w;
    for(int i = 0; i < n; i++){
        for(int j = 0; j < m; j++){
            cin >> 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;
        }
    }

    cout << res;
}

Compilation message (stderr)

/usr/bin/ld: /tmp/cc0mPMjY.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccqe3pN3.o:quality.cpp:(.text.startup+0x0): first defined here
/usr/bin/ld: /tmp/cc0mPMjY.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