Submission #799854

# Submission time Handle Problem Language Result Execution time Memory
799854 2023-08-01T07:05:53 Z GoldLight Quality Of Living (IOI10_quality) C++17
Compilation error
0 ms 0 KB
#include "quality.h"
#include <bits/stdc++.h>
using namespace std;

int rectangle(int r, int c, int h, int w, int q[3001][3001];) {
	int n=r*c, m=h*w;
    int ans=n, ki=1, ka=n;
    while(ki<=ka){
        int mid=(ki+ka)/2;
        vector<vector<int>> pref(r+1, vector<int>(c+1, 0));
        bool cek=false;
        //count qij<=mid
        for(int i=1; i<=r; i++){
            for(int j=1; j<=c; j++){
                pref[i][j]=(q[i][j]<=mid)+pref[i-1][j]+pref[i][j-1]-pref[i-1][j-1];
                if(i>=h && j>=w && pref[i][j]-pref[i-h][j]-pref[i][j-w]+pref[i-h][j-w]>=m/2+1){
                    cek=true;
                    break;
                }
            }
        }
        if(cek){
            ans=mid;
            ka=mid-1;
        }
        else ki=mid+1;
    }
    return ans;
}
// int main(){
//     int r, c, h, w; cin>>r>>c>>h>>w;
//     for(int i=1; i<=r; i++){
//         for(int j=1; j<=c; j++){
//             cin>>q[i][j];
//         }
//     }
//     cout<<rectangle(r, c, h, w);
// }

Compilation message

quality.cpp:5:60: error: expected ')' before ';' token
    5 | int rectangle(int r, int c, int h, int w, int q[3001][3001];) {
      |              ~                                             ^
      |                                                            )
quality.cpp:5:61: error: expected unqualified-id before ')' token
    5 | int rectangle(int r, int c, int h, int w, int q[3001][3001];) {
      |                                                             ^