#include "secret.h"
#include <iostream>
#include <cmath>
#include <unordered_map>
#include <map>
#include <set>
#include <queue>
#include <vector>
#include <string>
#include <iomanip>
#include <algorithm>
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
using namespace std;
typedef long long ll;
ll linf = 1e15+1;
inline void scoobydoobydoo(){
ios::sync_with_stdio(false);
ios_base::sync_with_stdio(false);
cin.tie(NULL); cout.tie(NULL);
}
/*int secret(int a, int b){
secretCounter++;
return max(a, b);
}*/
const int MAXN = 1e3+1;
int SRQ[MAXN][MAXN];
int Ar[MAXN];
int globul;
void initTree(int l, int r){
if (l == r)return;
int mid = (l+r)>>1;
SRQ[mid][mid] = Ar[mid];
SRQ[mid+1][mid+1] = Ar[mid+1];
for (int i = mid-1; i >= l; i--){
SRQ[mid][i] = secret(Ar[i], SRQ[mid][i+1]);
}
for (int i = mid+2; i <= r; i++){
SRQ[mid+1][i] = secret(Ar[i], SRQ[mid+1][i-1]);
}
initTree(l, mid);
initTree(mid+1, r);
}
void init(int N, int A[]){
for (int i = 0; i < N; i++){
Ar[i] = A[i];
}
globul = N;
initTree(0, N-1);
}
int followInit(int l, int r, int wL, int wR){
int mid = (l+r)>>1;
if (mid >= wL && mid < wR)return secret(SRQ[mid][wL], SRQ[mid+1][wR]);
if (mid == wR){
return SRQ[mid][wL];
}
if (l == r)return -1;
if (mid < wL){
return followInit(mid+1, r, wL, wR);
}
return followInit(l, mid, wL, wR);
}
int query(int l, int r){
return followInit(0, globul-1, l, r);
}
/*int main(){
scoobydoobydoo();
int N; cin >> N;
int A[8];
for (int i = 0; i < N; i++){
cin >> A[i];
}
int q; cin >> q;
init(N, A);
//cout << "sc " << secretCounter << endl;
while (q--){
int a, b; cin >> a >> b;
cout << query(a, b) << endl;
cout << "sc " << secretCounter << endl;
}
return 0;
}
*/
Compilation message
secret.cpp: In function 'void initTree(int, int)':
secret.cpp:44:23: error: 'secret' was not declared in this scope; did you mean 'Secret'?
44 | SRQ[mid][i] = secret(Ar[i], SRQ[mid][i+1]);
| ^~~~~~
| Secret
secret.cpp:47:25: error: 'secret' was not declared in this scope; did you mean 'Secret'?
47 | SRQ[mid+1][i] = secret(Ar[i], SRQ[mid+1][i-1]);
| ^~~~~~
| Secret
secret.cpp: In function 'int followInit(int, int, int, int)':
secret.cpp:63:38: error: 'secret' was not declared in this scope; did you mean 'Secret'?
63 | if (mid >= wL && mid < wR)return secret(SRQ[mid][wL], SRQ[mid+1][wR]);
| ^~~~~~
| Secret