제출 #357608

#제출 시각아이디문제언어결과실행 시간메모리
357608Mefarnis삶의 질 (IOI10_quality)C++14
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> #include "quality.h" #include "grader.h" #define maxn 3001 using namespace std; int sum[maxn][maxn]; int rectangle(int n, int m, int h, int w, int ar[][5]) { int N = n*m , ans; int l = 1 , r = N; while(l <= r) { int mid = (l+r) >> 1; memset(sum,0,sizeof(sum)); for( int i = 1 ; i <= n ; i++ ) for( int j = 1 ; j <= m ; j++ ) { int add = (ar[i-1][j-1] <= mid) ? +1 : -1; sum[i][j] = sum[i-1][j] + sum[i][j-1] - sum[i-1][j-1] + add; } bool ok = false; for( int row = h ; row <= n ; row++ ) for( int col = w ; col <= m ; col++ ) { int total = sum[row][col] - sum[row-h][col] - sum[row][col-w] + sum[row-h][col-w]; if(total > 0) ok = true; } if(ok) ans = mid , r = mid-1; else l = mid+1; } return ans; }

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

quality.cpp: In function 'int rectangle(int, int, int, int, int (*)[5])':
quality.cpp:32:9: warning: 'ans' may be used uninitialized in this function [-Wmaybe-uninitialized]
   32 |  return ans;
      |         ^~~
/tmp/ccMrkJyQ.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