Submission #738135

#TimeUsernameProblemLanguageResultExecution timeMemory
738135onebit1024Secret (JOI14_secret)C++17
30 / 100
470 ms4436 KiB
#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 timeMemoryGrader output
Fetching results...