Submission #207489

#TimeUsernameProblemLanguageResultExecution timeMemory
207489mayhoubsalehSecret (JOI14_secret)C++14
30 / 100
565 ms4728 KiB
#include "secret.h" #include <bits/stdc++.h> using namespace std; int sum[1010][20]; void Init(int n, int a[]) { for(int i=0;i<n;i++){ sum[i][0]=a[i]; } for(int i=1;i<10;i++){ for(int id=0;id<n&&id+(1<<i)<=n;id++){ sum[id][i]=Secret(sum[id][i-1],sum[id+(1<<(i-1))][i-1]); } } } int Query(int l, int r) { int len=(r-l+1); int ret=-1; for(int i=0;i<10;i++){ if(((1<<i)&len)==0)continue; if(ret==-1)ret=sum[l][i]; else ret=Secret(ret,sum[l][i]); l+=(1<<i); } return ret; }
#Verdict Execution timeMemoryGrader output
Fetching results...