제출 #856806

#제출 시각아이디문제언어결과실행 시간메모리
856806drome삶의 질 (IOI10_quality)C++14
컴파일 에러
0 ms0 KiB
#include "quality.h" #include <string.h> typedef long long ll; int rectangle(int R, int C, int H, int W, int Q[3001][3001]) { ll lo = 1, hi = R * C; int leq[3001][3001]; int ps[3001][3001]; for (int _=0;_<100;_++) { ll mi = (lo + hi) / 2; memset(leq, 0, sizeof(leq)); for (int i=0;i<R;i++) for (int j=0;j<C;j++) { leq[i][j] = (Q[i][j] <= mi); ps[i][j] = leq[i][j]; if (i) ps[i][j] += ps[i-1][j]; if (j) ps[i][j] += ps[i][j-1]; if (i && j) ps[i][j] -= ps[i-1][j-1]; } // cout << "MI: " << mi << endl; // for (int i=0;i<R;i++) { // for (int j=0;j<C;j++) { // cout << leq[i][j] << " "; // } // cout << endl; // } // for (int i=0;i<R;i++) { // for (int j=0;j<C;j++) { // cout << ps[i][j] << " "; // } // cout << endl; // } ll maxsum = 0; for (int i=0;i+H<=R;i++) for (int j=0;j+W<=C;j++) { ll sum = ps[i+H-1][j+W-1]; if (i) sum -= ps[i-1][j+W-1]; if (j) sum -= ps[i+H-1][j-1]; if (i && j) sum += ps[i-1][j-1]; maxsum = max(maxsum, sum); } // cout << "maxsum: " << maxsum << endl; if (maxsum > (W * H) / 2) hi = mi; else lo = mi + 1; } return lo; }

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

quality.cpp: In function 'int rectangle(int, int, int, int, int (*)[3001])':
quality.cpp:45:13: error: 'max' was not declared in this scope
   45 |    maxsum = max(maxsum, sum);
      |             ^~~