#include "secret.h"
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
#define rng(i,s,n) for(ll i = (s) ; i < (n) ; i++)
#define rep(i,n) rng(i, 0, (n))
#define vec vector
#define pb emplace_back
#define siz(a) (int)(a).size()
vec<ll>a;
class dsp{
int n,rr;
vec<vec<ll>>dat;
vec<int>lgt;
public:
void init(int sz){
n=sz;
int rr=2,cnt=1;//バケットサイズ
while(rr<n) rr*=2,cnt++;
dat.assign(cnt,vec<ll>(n,0));
rep(i,n) dat[0][i]=a[i];
rng(k,1,cnt){
for(int j=0;j<n;j+=(1<<(k+1))){
int t=j+(1<<k);
if(t>=n) continue;
dat[k][t-1]=a[t-1],dat[k][t]=a[t];
for(int r=t-2;r>=j;r--){
dat[k][r]=Secret(a[r],dat[k][r+1]);
}
for(int r=t+1;r<j+(1<<(k+1));r++){
dat[k][r]=Secret(a[r],dat[k][r-1]);
}
}
}
lgt.assign(n+10,0);
for(int i=2;i<n+10;i++) lgt[i]=lgt[i>>1]+1;
}
int query(int x,int y){
if(x==y) return dat[0][x];
int k=lgt[x^y];
return Secret(dat[k][x],dat[k][y]);
}
} dsp;
void Init(int N, int A[]) {
rep(i,N) a.pb(A[i]);
dsp.init(N);
}
int Query(int L, int R) {
int k=dsp.query(L,R);
return k;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
140 ms |
4716 KB |
Execution killed with signal 6 (could be triggered by violating memory limits) |
2 |
Incorrect |
155 ms |
2412 KB |
Wrong Answer: Query(60, 375) - expected : 669221184, actual : 68749376. |
3 |
Runtime error |
146 ms |
4820 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
4 |
Runtime error |
520 ms |
8940 KB |
Execution killed with signal 6 (could be triggered by violating memory limits) |
5 |
Runtime error |
533 ms |
8744 KB |
Execution killed with signal 6 (could be triggered by violating memory limits) |
6 |
Runtime error |
506 ms |
8684 KB |
Execution killed with signal 6 (could be triggered by violating memory limits) |
7 |
Runtime error |
559 ms |
8812 KB |
Execution killed with signal 6 (could be triggered by violating memory limits) |
8 |
Runtime error |
517 ms |
8684 KB |
Execution killed with signal 6 (could be triggered by violating memory limits) |
9 |
Runtime error |
556 ms |
8684 KB |
Execution killed with signal 6 (could be triggered by violating memory limits) |
10 |
Runtime error |
508 ms |
8812 KB |
Execution killed with signal 6 (could be triggered by violating memory limits) |