Submission #237385

#TimeUsernameProblemLanguageResultExecution timeMemory
237385kshitij_sodani삶의 질 (IOI10_quality)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; typedef int64_t llo; #define mp make_pair #define pb push_back #define a first #define b second #include "quality.h" int n,m,aa,bb; int it[3001][3001]; int pre[3001][3001]; int calc(int ac,int bc){ return pre[ac][bc]-pre[ac][bc-bb]-pre[ac-aa][bc]+pre[ac-aa][bc-bb]; } int check(int mid){ for(int i=1;i<n+1;i++){ for(int j=1;j<m+1;j++){ if(it[i-1][j-1]<mid){ pre[i][j]=-1; } else if(it[i-1][j-1]==mid){ pre[i][j]=0; } else{ pre[i][j]=1; } } } for(int i=1;i<n+1;i++){ for(int j=1;j<m+1;j++){ pre[i][j]=pre[i-1][j]+pre[i][j]+pre[i][j-1]-pre[i-1][j-1]; } } int ma=1; for(int i=aa;i<n+1;i++){ for(int j=bb;j<m+1;j++){ ma=min(ma,calc(i,j)); } } return ma; } int rectangle(int nn,int mm,int aaa,int bbb,int tt[][]){ n=nn; m=mm; aa=aaa; bb=bbb; for(int i=0;i<n;i++){ for(int j=0;j<m;j++){ it[i][j]=tt[i][j]; } } int low=1; int high=n*m; while(low<high-1){ int mid=(low+high)/2; if(check(mid)<=0){ high=mid; } else{ low=mid; } } int ans=high; if(check(low)<=0){ ans=min(ans,low); } return ans; // cout<<ans<<endl; } /*int main(){ ios_base::sync_with_stdio(false); cin.tie(NULL); cin>>n>>m>>aa>>bb; return 0; }*/

Compilation message (stderr)

quality.cpp:45:55: error: declaration of 'tt' as multidimensional array must have bounds for all dimensions except the first
 int rectangle(int nn,int  mm,int aaa,int bbb,int tt[][]){
                                                       ^
quality.cpp: In function 'int rectangle(...)':
quality.cpp:46:4: error: 'nn' was not declared in this scope
  n=nn;
    ^~
quality.cpp:46:4: note: suggested alternative: 'n'
  n=nn;
    ^~
    n
quality.cpp:47:4: error: 'mm' was not declared in this scope
  m=mm;
    ^~
quality.cpp:47:4: note: suggested alternative: 'm'
  m=mm;
    ^~
    m
quality.cpp:48:5: error: 'aaa' was not declared in this scope
  aa=aaa;
     ^~~
quality.cpp:48:5: note: suggested alternative: 'aa'
  aa=aaa;
     ^~~
     aa
quality.cpp:49:5: error: 'bbb' was not declared in this scope
  bb=bbb;
     ^~~
quality.cpp:49:5: note: suggested alternative: 'bb'
  bb=bbb;
     ^~~
     bb
quality.cpp:52:13: error: 'tt' was not declared in this scope
    it[i][j]=tt[i][j];
             ^~
quality.cpp:52:13: note: suggested alternative: 'it'
    it[i][j]=tt[i][j];
             ^~
             it