제출 #511026

#제출 시각아이디문제언어결과실행 시간메모리
511026tabr삶의 질 (IOI10_quality)C++17
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; #ifdef tabr #include "library/debug.cpp" #else #define debug(...) #endif int rectangle(int r, int c, int h, int w, int q[][]) { int low = 0; int high = r * c; while (high - low > 1) { int mid = (high + low) / 2; int ok = 0; vector<vector<int>> pref(r + 1, vector<int>(c + 1)); for (int i = 0; i < r; i++) { for (int j = 0; j < c; j++) { pref[i + 1][j + 1] = pref[i + 1][j] + pref[i][j + 1] - pref[i][j] + (q[i][j] >= mid); } } for (int i = 0; i <= r - h; i++) { for (int j = 0; j <= c - w; j++) { if (pref[i + h][j + w] - pref[i][j + 1] - pref[i + h][j] + pref[i][j] > h * w / 2) { ok = 1; } } } if (ok) { low = mid; } else { high = mid; } } return low; } #ifdef tabr int main() { ios::sync_with_stdio(false); cin.tie(0); return 0; } #endif

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

quality.cpp:9:47: error: declaration of 'q' as multidimensional array must have bounds for all dimensions except the first
    9 | int rectangle(int r, int c, int h, int w, int q[][]) {
      |                                               ^
quality.cpp: In function 'int rectangle(...)':
quality.cpp:11:16: error: 'r' was not declared in this scope
   11 |     int high = r * c;
      |                ^
quality.cpp:11:20: error: 'c' was not declared in this scope
   11 |     int high = r * c;
      |                    ^
quality.cpp:18:86: error: 'q' was not declared in this scope
   18 |                 pref[i + 1][j + 1] = pref[i + 1][j] + pref[i][j + 1] - pref[i][j] + (q[i][j] >= mid);
      |                                                                                      ^
quality.cpp:21:34: error: 'h' was not declared in this scope
   21 |         for (int i = 0; i <= r - h; i++) {
      |                                  ^
quality.cpp:22:38: error: 'w' was not declared in this scope
   22 |             for (int j = 0; j <= c - w; j++) {
      |                                      ^