# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1053650 | phong | Secret (JOI14_secret) | C++17 | 0 ms | 0 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
//#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,fma")
//#pragma GCC optimize("unroll-loops")
//#include<bits/stdc++.h>
#include "secret.h"
#define ll long long
const int nmax = 1000 + 5;
const int lg = 17;
using namespace std;
int n, a[nmax];
int rmq[nmax][lg + 1];
void Init(int N, int A[]){
n = N;
for(int i = 1; i <= n; ++i) rmq[i][0] = A[i - 1];
for(int j = 1; j <= lg; ++j){
for(int i = 1; i + (1 << j) - 1 <= N; ++i){
rmq[i][j] = Secret(rmq[i][j - 1], rmq[i + (1 << (j - 1))][j - 1]);
}
}
}
int Query(int L, int R){
int k = __lg(R - L + 1);
return Secret(rmq[L][k], rmq[R - (1 <<k) + 1][k]);
}