#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;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Partially correct |
169 ms |
2556 KB |
Output is partially correct - number of calls to Secret by Init = 3586, maximum number of calls to Secret by Query = 7 |
2 |
Partially correct |
171 ms |
2552 KB |
Output is partially correct - number of calls to Secret by Init = 3595, maximum number of calls to Secret by Query = 7 |
3 |
Partially correct |
171 ms |
2552 KB |
Output is partially correct - number of calls to Secret by Init = 3604, maximum number of calls to Secret by Query = 7 |
4 |
Partially correct |
546 ms |
4472 KB |
Output is partially correct - number of calls to Secret by Init = 7978, maximum number of calls to Secret by Query = 8 |
5 |
Partially correct |
541 ms |
4600 KB |
Output is partially correct - number of calls to Secret by Init = 7987, maximum number of calls to Secret by Query = 8 |
6 |
Partially correct |
518 ms |
4472 KB |
Output is partially correct - number of calls to Secret by Init = 7987, maximum number of calls to Secret by Query = 2 |
7 |
Partially correct |
556 ms |
4472 KB |
Output is partially correct - number of calls to Secret by Init = 7987, maximum number of calls to Secret by Query = 8 |
8 |
Partially correct |
564 ms |
4728 KB |
Output is partially correct - number of calls to Secret by Init = 7987, maximum number of calls to Secret by Query = 7 |
9 |
Partially correct |
565 ms |
4576 KB |
Output is partially correct - number of calls to Secret by Init = 7987, maximum number of calls to Secret by Query = 8 |
10 |
Partially correct |
554 ms |
4472 KB |
Output is partially correct - number of calls to Secret by Init = 7987, maximum number of calls to Secret by Query = 7 |