제출 #595776

#제출 시각아이디문제언어결과실행 시간메모리
595776snasibov05삶의 질 (IOI10_quality)C++14
컴파일 에러
0 ms0 KiB
#include "quality.h" #include "bits/stdc++.h" bool check(int k, int r, int c, int h, int w, int q[3001][3001]){ vector<vector<int>> cntp(r, vector<int>(c)); for (int i = 0; i < r; ++i){ for (int j = 0; j < c; ++j){ if (i != 0) cntp[i][j] += cntp[i-1][j]; if (j != 0) cntp[i][j] += cntp[i][j-1]; if (i != 0 && j != 0) cntp[i][j] -= cntp[i-1][j-1]; cntp[i][j] += q[i][j] <= k; } } for (int i = h-1; i < r; ++i){ for (int j = w-1; j < c; ++j){ int cnt = cntp[i][j]; if (i != h-1) cnt -= cntp[i - h][j]; if (j != w-1) cnt -= cntp[i][j - w]; if (i != h-1 && j != w-1) cnt += cntp[i - h][j - w]; if (cnt > h * w / 2) return true; } } return false; } int rectangle(int R, int C, int H, int W, int Q[3001][3001]) { int l = 1, r = R*C; int bst = 0; while (l <= r){ int mid = (l + r) / 2; if (check(mid, R, C, H, W, Q)) bst = mid, r = mid - 1; else l = mid + 1; } return bst; }

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

quality.cpp: In function 'bool check(int, int, int, int, int, int (*)[3001])':
quality.cpp:6:5: error: 'vector' was not declared in this scope; did you mean 'std::vector'?
    6 |     vector<vector<int>> cntp(r, vector<int>(c));
      |     ^~~~~~
      |     std::vector
In file included from /usr/include/c++/10/vector:67,
                 from /usr/include/c++/10/queue:61,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:86,
                 from quality.cpp:2:
/usr/include/c++/10/bits/stl_vector.h:389:11: note: 'std::vector' declared here
  389 |     class vector : protected _Vector_base<_Tp, _Alloc>
      |           ^~~~~~
quality.cpp:6:19: error: expected primary-expression before 'int'
    6 |     vector<vector<int>> cntp(r, vector<int>(c));
      |                   ^~~
quality.cpp:9:25: error: 'cntp' was not declared in this scope
    9 |             if (i != 0) cntp[i][j] += cntp[i-1][j];
      |                         ^~~~
quality.cpp:10:25: error: 'cntp' was not declared in this scope
   10 |             if (j != 0) cntp[i][j] += cntp[i][j-1];
      |                         ^~~~
quality.cpp:11:35: error: 'cntp' was not declared in this scope
   11 |             if (i != 0 && j != 0) cntp[i][j] -= cntp[i-1][j-1];
      |                                   ^~~~
quality.cpp:12:13: error: 'cntp' was not declared in this scope
   12 |             cntp[i][j] += q[i][j] <= k;
      |             ^~~~
quality.cpp:18:23: error: 'cntp' was not declared in this scope; did you mean 'cnt'?
   18 |             int cnt = cntp[i][j];
      |                       ^~~~
      |                       cnt