#include <bits/stdc++.h>
using namespace std;
int Secret(int l, int r);
vector<vector<int>>dvc;
vector<int>arr;
void dc(int l, int r, int lvl){
if(l==r){
dvc[lvl][l]=arr[l];
}
int mid=(l+r)/1;
dvc[lvl][mid]=arr[mid];
dvc[lvl][mid+1]=arr[mid+1];
for(int i=mid-1;i>=l;i--){
dvc[lvl][i]=Secret(dvc[lvl][i+1],arr[i]);
}
for(int i=mid+2;i<=r;i++){
dvc[lvl][i]=Secret(dvc[lvl][i-1],arr[i]);
}
dc(l,mid,lvl+1);
dc(mid+1,r,lvl+1);
}
void Init(int n, int a[]){
arr.resize(n);
for(int i=0;i<n;i++){
arr[i]=a[i];
}
dvc.resize(21,vector<int>(n));
dc(0,n-1,0);
}
int retorno(int a,int b,int l,int r, int lvl){
int mid=(a+b)/2;
if(a==b){
return dvc[lvl][l];
}
if(r<(mid+1)){
return retorno(l,mid,l,r,lvl+1);
}
else if(l>mid){
return retorno(mid+1,r,l,r,lvl+1);
}
return Secret(dvc[lvl][l],dvc[lvl][r]);
}
int Query(int l,int r){
return retorno(0,arr.size()-1,l,r,0);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
84 ms |
5200 KB |
Execution killed with signal 11 |
2 |
Runtime error |
84 ms |
5224 KB |
Execution killed with signal 11 |
3 |
Runtime error |
88 ms |
5200 KB |
Execution killed with signal 11 |
4 |
Runtime error |
312 ms |
8612 KB |
Execution killed with signal 11 |
5 |
Runtime error |
309 ms |
8624 KB |
Execution killed with signal 11 |
6 |
Runtime error |
314 ms |
8784 KB |
Execution killed with signal 11 |
7 |
Runtime error |
315 ms |
8612 KB |
Execution killed with signal 11 |
8 |
Runtime error |
315 ms |
8788 KB |
Execution killed with signal 11 |
9 |
Runtime error |
306 ms |
8568 KB |
Execution killed with signal 11 |
10 |
Runtime error |
318 ms |
8788 KB |
Execution killed with signal 11 |