# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
503985 | 2022-01-09T11:56:01 Z | Abrar_Al_Samit | Secret (JOI14_secret) | C++17 | 0 ms | 0 KB |
#include "secret.h" #include "bits\stdc++.h" using namespace std; vector<vector<int>>sp(1001, vector<int>(11)); void Init(int N, int A[]) { for(int i=0; i<N; ++i) { sp[i][0] = A[i]; } for(int j=1; j<11; ++j) { for(int i=0; i+(1<<j)-1<N; ++i) { sp[i][j] = Secret(sp[i][j-1], sp[i+(1<<j)][j-1]); } } } int Query(int L, int R) { int len = R-L+1; int id = L; int ret = 0; for(int j=0; j<11; ++j) if(len>>j&1) { ret = Secret(ret, sp[id][j]); id += 1<<j; } return ret; }