# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
207489 | mayhoubsaleh | Secret (JOI14_secret) | C++14 | 565 ms | 4728 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;
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 time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |