# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
738135 | onebit1024 | Secret (JOI14_secret) | C++17 | 470 ms | 4436 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.
#include "secret.h"
#include <bits/stdc++.h>
using namespace std;
vector<vector<int>>dp;
void Init(int N, int A[]) {
dp = vector<vector<int>>(N, vector<int>(11));
for(int i = 0;i<N;++i)dp[i][0] = A[i];
for(int j = 1;j<=10;++j){
for(int i = 0;(i+(1ll<<j))-1 < N;++i){
dp[i][j] = Secret(dp[i][j-1],dp[i+(1ll<<(j-1))][j-1]);
}
}
}
int Query(int L, int R) {
int res = -1;
for(int i = 10;i>=0;--i){
if((L+(1ll<<i))-1 <= R){
if(res==-1)res = dp[L][i];
else res = Secret(res, dp[L][i]);
L+=(1ll<<i);
}
}
return res;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |