제출 #1303934

#제출 시각아이디문제언어결과실행 시간메모리
1303934maxiedSecret (JOI14_secret)C++20
컴파일 에러
0 ms0 KiB
template <typename T, typename F> class DisjointSparseTable { public: int n; vector<vector<T>> mat; F func; DisjointSparseTable(const vector<T>& a, const F& f) : n(int(a.size())), func(f) { mat.push_back(a); for (int p = 1; (1 << p) < n; p++) { mat.emplace_back(n); for (int mid = 1 << p; mid < n; mid += 1 << (p + 1)) { mat[p][mid - 1] = a[mid - 1]; for (int j = mid - 2; j >= mid - (1 << p); j--) { mat[p][j] = func(a[j], mat[p][j + 1]); } mat[p][mid] = a[mid]; for (int j = mid + 1; j < min(n, mid + (1 << p)); j++) { mat[p][j] = func(mat[p][j - 1], a[j]); } } } } T Query(int l, int r) const { assert(0 <= l && l < r && r <= n); if (r - l == 1) { return mat[0][l]; } int p = bit_width(unsigned(l ^ (r - 1))) - 1; return func(mat[p][l], mat[p][r - 1]); } };

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

secret.cpp:5:10: error: 'vector' was not declared in this scope
    5 |   vector<vector<T>> mat;
      |          ^~~~~~
secret.cpp:5:10: error: 'vector' was not declared in this scope
secret.cpp:5:10: error: 'vector' was not declared in this scope
secret.cpp:5:10: error: 'vector' was not declared in this scope
secret.cpp:5:10: error: 'vector' was not declared in this scope
secret.cpp:5:10: error: 'vector' was not declared in this scope
secret.cpp:5:10: error: 'vector' was not declared in this scope
secret.cpp:5:10: error: 'vector' was not declared in this scope
secret.cpp:5:10: error: 'vector' was not declared in this scope
secret.cpp:5:10: error: 'vector' was not declared in this scope
secret.cpp:5:3: error: 'vector' does not name a type
    5 |   vector<vector<T>> mat;
      |   ^~~~~~
secret.cpp:8:29: error: 'vector' does not name a type
    8 |   DisjointSparseTable(const vector<T>& a, const F& f) : n(int(a.size())), func(f) {
      |                             ^~~~~~
secret.cpp:8:35: error: expected ',' or '...' before '<' token
    8 |   DisjointSparseTable(const vector<T>& a, const F& f) : n(int(a.size())), func(f) {
      |                                   ^
secret.cpp: In constructor 'DisjointSparseTable<T, F>::DisjointSparseTable(int)':
secret.cpp:8:63: error: 'a' was not declared in this scope
    8 |   DisjointSparseTable(const vector<T>& a, const F& f) : n(int(a.size())), func(f) {
      |                                                               ^
secret.cpp:8:80: error: 'f' was not declared in this scope
    8 |   DisjointSparseTable(const vector<T>& a, const F& f) : n(int(a.size())), func(f) {
      |                                                                                ^
secret.cpp:9:5: error: 'mat' was not declared in this scope
    9 |     mat.push_back(a);
      |     ^~~
secret.cpp:18:35: error: there are no arguments to 'min' that depend on a template parameter, so a declaration of 'min' must be available [-fpermissive]
   18 |         for (int j = mid + 1; j < min(n, mid + (1 << p)); j++) {
      |                                   ^~~
secret.cpp:18:35: note: (if you use '-fpermissive', G++ will accept your code, but allowing the use of an undeclared name is deprecated)
secret.cpp: In member function 'T DisjointSparseTable<T, F>::Query(int, int) const':
secret.cpp:26:5: error: there are no arguments to 'assert' that depend on a template parameter, so a declaration of 'assert' must be available [-fpermissive]
   26 |     assert(0 <= l && l < r && r <= n);
      |     ^~~~~~
secret.cpp:28:14: error: 'mat' was not declared in this scope
   28 |       return mat[0][l];
      |              ^~~
secret.cpp:30:13: error: there are no arguments to 'bit_width' that depend on a template parameter, so a declaration of 'bit_width' must be available [-fpermissive]
   30 |     int p = bit_width(unsigned(l ^ (r - 1))) - 1;
      |             ^~~~~~~~~
secret.cpp:31:17: error: 'mat' was not declared in this scope
   31 |     return func(mat[p][l], mat[p][r - 1]);
      |                 ^~~