제출 #1291527

#제출 시각아이디문제언어결과실행 시간메모리
1291527sula2비밀 (JOI14_secret)C++20
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #define popcount __builtin_popcount #define all(a) (a).begin(), (a).end() using namespace std; using namespace chrono; using namespace __gnu_pbds; template<typename T> using ordered_set = tree<T,null_type,less_equal<>,rb_tree_tag,tree_order_statistics_node_update>; //#include "secret.h" vector<int> _a; vector<int> lay[20]; vector<int> mids[20]; void init(int l, int r, vector<int>& a, int dep = 0) { if (l == r) return; int mid = (l+r)/2; mids[dep].push_back(mid); lay[dep][mid] = a[mid]; lay[dep][mid+1] = a[mid+1]; for (int i = mid-1; i >= l; i--) lay[dep][i] = Secret(a[i], lay[dep][i+1]); for (int i = mid+2; i <= r; i++) lay[dep][i] = Secret(lay[dep][i-1], a[i]); init(l, mid, a, dep + 1); init(mid+1, r, a, dep + 1); } void Init(int n, int* a) { for (int i = 0; i < 20; i++) lay[i].resize(n); _a.resize(n); for (int i = 0; i < n; i++) _a[i] = a[i]; init(0, n-1, _a); } int Query(int l, int r) { if (l == r) return _a[l]; for (int d = 0; d < 20; d++) { for (int mid : mids[d]) { if (l <= mid && mid <= r) { return Secret(lay[d][l], lay[d][r]); } } } return 1; }

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

secret.cpp: In function 'void init(int, int, std::vector<int>&, int)':
secret.cpp:23:23: error: 'Secret' was not declared in this scope
   23 |         lay[dep][i] = Secret(a[i], lay[dep][i+1]);
      |                       ^~~~~~
secret.cpp:25:23: error: 'Secret' was not declared in this scope
   25 |         lay[dep][i] = Secret(lay[dep][i-1], a[i]);
      |                       ^~~~~~
secret.cpp: In function 'int Query(int, int)':
secret.cpp:44:24: error: 'Secret' was not declared in this scope
   44 |                 return Secret(lay[d][l], lay[d][r]);
      |                        ^~~~~~