제출 #1105583

#제출 시각아이디문제언어결과실행 시간메모리
1105583andrewp삶의 질 (IOI10_quality)C++14
컴파일 에러
0 ms0 KiB
#include "quality.h"
#include<bits/stdc++.h>
using namespace std;
int rectangle(int n, int m, int H, int W, int A[3001][3001]){
    int a[n+10][m+10];
    for(int i=1;i<=n;i++) for(int j=1;j<=m;j++) a[i][j]=A[i-1][j-1];
    int bot=1,top=n*m,ans;
    while(bot<=top){
        int mid=l+r>>1; 
        int ps[n+10][m+10];
        for(int i=0;i<n+10;i++) for(int j=0;j<m+10;j++) ps[i][j]=0;
        for(int i=1;i<=n;i++){
            for(int j=1;j<=m;j++){
                ps[i][j]=ps[i-1][j]+ps[i][j-1]-ps[i-1][j-1]; 
                if(A[i][j]>mid) ps[i][j]++;
            } 
        }
        int val=m*n+50; 
        for(int i=1;i<=n;i++){
            for(int j=1;j<=m;j++){ 
                if(i<H||j<W) continue;  
                val=min(val,ps[i][j]-ps[i-H][j]-ps[i][j-W]+ps[i-H][j-W]);
            }
        }
        if(val<=H*W/2){
            res=mid;
            top=mid-1;
        } 
        else bot=mid+1;
    }
    return ans;
}

컴파일 시 표준 에러 (stderr) 메시지

quality.cpp: In function 'int rectangle(int, int, int, int, int (*)[3001])':
quality.cpp:9:17: error: 'l' was not declared in this scope
    9 |         int mid=l+r>>1;
      |                 ^
quality.cpp:9:19: error: 'r' was not declared in this scope
    9 |         int mid=l+r>>1;
      |                   ^
quality.cpp:26:13: error: 'res' was not declared in this scope
   26 |             res=mid;
      |             ^~~