#include "secret.h"
#include<bits/stdc++.h>
#define int long long
using namespace std;
int x[1005][1005],a[1005],n;
void solve(int l,int r) {
if(l==r) return;
int mid = (l+r)/2;
x[mid][mid] = a[mid];
for(int i=mid-1;i>=l;i--) {
x[i][mid] = Secret(a[i],x[i+1][mid]);
}
x[mid+1][mid+1]=a[mid+1];
for(int i=mid+2;i<=r;i++) {
x[mid+1][i] = Secret(x[mid+1][i-1],a[i]);
}
solve(l,mid);
solve(mid+1,r);
}
void Init(int m, int A[]) {
// Secret(0, 1000000000);
n = m;
for(int i = n; i>0; i--) {
a[i] = A[i-1];
}
solve(1,n);
}
int Query(int L, int R) { //cout<<"++";cout<<"++";
L++; R++;
if(L == R) return a[L];
int l = 1, r = n;
while(true) {
int mid = (l+r)/2;
if(l<=mid && R==mid) return x[L][mid];
if(L==mid+1 && R>mid) return x[mid+1][R];
if(R<=mid) {
r = mid ;
continue;
}
if(L>mid) {
l = mid + 1;
continue;
}
// cout<<L<<" "<<mid<<" "<<x[L][mid]<<" "<<a[R]<<endl;
return Secret(x[L][mid],x[mid+1][R]);
}
}
Compilation message
/usr/bin/ld: /tmp/ccomNLOQ.o: in function `main':
grader-full.cpp:(.text.startup+0x2a8): undefined reference to `Init(int, int*)'
/usr/bin/ld: grader-full.cpp:(.text.startup+0x30b): undefined reference to `Query(int, int)'
collect2: error: ld returned 1 exit status