#include "secret.h"
#include <bits/stdc++.h>
using namespace std;
int seg[4000],n,arr[1000],cnt=0;
void update(int idx=1,int l=0,int r = n-1){
if(l == r){
seg[idx] = arr[l];
return;
}
int mid = (l+r)>>1;
update(idx<<1,mid+1,r);
update(idx<<1|1,l,mid);
seg[idx] = Secret(seg[idx<<1], seg[idx<<1|1]);
}
int query(int L,int R,int idx=1,int l=0,int r=n-1){
if(l >= L && r <= R)return seg[idx];
if(r < L || l > R)return -1;
int mid = (l+r)>>1;
int first = query(L,R,idx<<1,mid+1,r);
int second = query(L,R,idx<<1|1,l,mid);
if(first != -1 && second != -1){
cnt++;
return Secret(first,second);
}
else if(first != -1)
return first;
else if(second != -1)
return second;
else return -1;
}
void Init(int N,int A[]){
n = N;
for(int i=0;i<n;i++)arr[i] = A[i];
update();
}
int Query(int l,int r){
return query(l,r);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
124 ms |
2280 KB |
Wrong Answer: Query(222, 254) - expected : 34031541, actual : 34607541. |
2 |
Incorrect |
125 ms |
2452 KB |
Wrong Answer: Query(60, 375) - expected : 669221184, actual : 795052233. |
3 |
Incorrect |
115 ms |
2380 KB |
Wrong Answer: Query(211, 401) - expected : 674373968, actual : 496080966. |
4 |
Incorrect |
438 ms |
4268 KB |
Wrong Answer: Query(90, 497) - expected : 397934825, actual : 339739196. |
5 |
Incorrect |
431 ms |
4216 KB |
Wrong Answer: Query(587, 915) - expected : 752404486, actual : 426810446. |
6 |
Incorrect |
441 ms |
4176 KB |
Wrong Answer: Query(738, 741) - expected : 983692994, actual : 850129153. |
7 |
Incorrect |
436 ms |
4276 KB |
Wrong Answer: Query(84, 976) - expected : 742463504, actual : 638095410. |
8 |
Incorrect |
421 ms |
4240 KB |
Wrong Answer: Query(58, 987) - expected : 20022464, actual : 426111120. |
9 |
Incorrect |
421 ms |
4300 KB |
Wrong Answer: Query(33, 967) - expected : 676869696, actual : 547103880. |
10 |
Incorrect |
448 ms |
4224 KB |
Wrong Answer: Query(116, 961) - expected : 68487362, actual : 604842184. |