Submission #766888

#TimeUsernameProblemLanguageResultExecution timeMemory
766888irmuunQuality Of Living (IOI10_quality)C++17
Compilation error
0 ms0 KiB
#include<bits/stdc++.h> #include "quality.h" using namespace std; #define pb push_back #define ll long long #define ff first #define ss second #define all(s) s.begin(),s.end() int rectangle(int R,int C,int H,int W,int Q[][]){ int sum[R+1][C+1],m=H*W/2+1; int l=1,r=R*C; while(l<r){ int mid=(l+r)/2; bool ok=false; sum[0][0]=0; for(int i=0;i<=R;i++){ for(int j=0;j<=C;j++){ if(i==0||j==0){ sum[i][j]=0; continue; } sum[i][j]=sum[i-1][j]+sum[i][j-1]-sum[i-1][j-1]+(Q[i-1][j-1]<=mid); if(i>=H&&j>=W){ if(sum[i][j]-sum[i-H][j]-sum[i][j-W]+sum[i-H][j-W]>=m){ ok=true; } } } } if(ok==true){ r=mid; } else{ l=mid+1; } } return l; }

Compilation message (stderr)

quality.cpp:12:43: error: declaration of 'Q' as multidimensional array must have bounds for all dimensions except the first
   12 | int rectangle(int R,int C,int H,int W,int Q[][]){
      |                                           ^
quality.cpp: In function 'int rectangle(...)':
quality.cpp:13:13: error: 'R' was not declared in this scope
   13 |     int sum[R+1][C+1],m=H*W/2+1;
      |             ^
quality.cpp:13:18: error: 'C' was not declared in this scope
   13 |     int sum[R+1][C+1],m=H*W/2+1;
      |                  ^
quality.cpp:13:25: error: 'H' was not declared in this scope
   13 |     int sum[R+1][C+1],m=H*W/2+1;
      |                         ^
quality.cpp:13:27: error: 'W' was not declared in this scope
   13 |     int sum[R+1][C+1],m=H*W/2+1;
      |                           ^
quality.cpp:18:9: error: 'sum' was not declared in this scope
   18 |         sum[0][0]=0;
      |         ^~~
quality.cpp:25:66: error: 'Q' was not declared in this scope
   25 |                 sum[i][j]=sum[i-1][j]+sum[i][j-1]-sum[i-1][j-1]+(Q[i-1][j-1]<=mid);
      |                                                                  ^