Submission #1145444

#TimeUsernameProblemLanguageResultExecution timeMemory
1145444NewtonabcSecret (JOI14_secret)C++20
0 / 100
332 ms4440 KiB
#include "secret.h" int dp[1010][10]; //ans of i to i+(1<<j)-1 to the right //j=0->7 int arr[1010]; void Init(int N, int A[]) { for(int i=0;i<N;i++) arr[i]=A[i]; for(int i=0;i<N;i++) dp[i][0]=A[i]; for(int i=0;i<N;i++){ for(int j=1;j<=7;j++){ if(i+(1<<j)-1>=N) break; dp[i][j]=Secret(dp[i][j-1],dp[i+(1<<(j-1))][j-1]); } } } int Query(int L, int R) { int ans=arr[L++]; int now=L; while((1<<7)<=R-now+1){ ans=Secret(ans,dp[now][7]); now+=(1<<7); } for(int i=7;i>=0;i--){ if((1<<i)<=R-now+1){ ans=Secret(ans,dp[now][i]); now+=(1<<i); } } return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...