Submission #699868

#TimeUsernameProblemLanguageResultExecution timeMemory
699868vjudge1Quality Of Living (IOI10_quality)C++14
Compilation error
0 ms0 KiB
#include<bits/stdc++.h> using namespace std; const int N=1010; int n,m,h,w; int a[N][N],sum[N][N]; int get(int SX,int SY,int EX,int EY){return sum[EX][EY]-sum[SX-1][EY]-sum[EX][SY-1]+sum[SX-1][SY-1];} int check(int mid) { for(int i=1;i<=n;i++) for(int j=1;j<=m;j++) sum[i][j]=(a[i][j]>mid?-1:1)+sum[i-1][j]+sum[i][j-1]-sum[i-1][j-1]; for(int i=1;i+h-1<=n;i++) for(int j=1;j+w-1<=m;j++) if(get(i,j,i+h-1,j+w-1)>0)return 1; return 0; } int main() { scanf("%d%d%d%d",&n,&m,&h,&w); for(int i=1;i<=n;i++) for(int j=1;j<=m;j++) scanf("%d",&a[i][j]); int l=0,r=n*m; while(l<r) { int mid=(l+r)>>1; if(check(mid))r=mid; else l=mid+1; } printf("%d\n",l); return 0; }

Compilation message (stderr)

quality.cpp: In function 'int main()':
quality.cpp:19:7: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   19 |  scanf("%d%d%d%d",&n,&m,&h,&w);
      |  ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
quality.cpp:22:9: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   22 |    scanf("%d",&a[i][j]);
      |    ~~~~~^~~~~~~~~~~~~~~
/usr/bin/ld: /tmp/ccZxHRNO.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccKznSTS.o:quality.cpp:(.text.startup+0x0): first defined here
/usr/bin/ld: /tmp/ccZxHRNO.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