#include <bits/stdc++.h>
#include "secret.h"
int memo[1000][1000], n;
int build(int l, int r, int A[]){
int m = (l + r) / 2;
memo[m][m] = A[m];
memo[m + 1][m + 1] = A[m + 1];
for(int i = m + 2; i <= r; i++) memo[m + 1][i] = Secret(memo[m + 1][i - 1], A[i]);
for(int i = m - 1; i >= l; i--) memo[m][i] = Secret(memo[m][i + 1], A[i]);
if(l < m) build(l, m, A);
if(m + 1 < r) build(m + 1, r, A);
}
void Init(int N, int A[]){
n = N;
build(0, n - 1, A);
}
int Query(int L, int R){
int l = 0, r = n - 1;
while(l < r){
int m = (l + r) / 2;
if(L <= m && m < R) Secret(memo[m][L], memo[m + 1][R]);
else if(mid == R) return memo[m][L];
else if(mid < L) l = m + 1;
else r = m;
}
}
Compilation message
secret.cpp: In function 'int build(int, int, int*)':
secret.cpp:14:1: warning: no return statement in function returning non-void [-Wreturn-type]
14 | }
| ^
secret.cpp: In function 'int Query(int, int)':
secret.cpp:26:13: error: 'mid' was not declared in this scope
26 | else if(mid == R) return memo[m][L];
| ^~~
secret.cpp:30:1: warning: control reaches end of non-void function [-Wreturn-type]
30 | }
| ^