#include "secret.h"
using namespace std;
int seg[4000],n,arr[1000],cnt=0;
void update(int idx=0,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=0,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);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
120 ms |
2368 KB |
Wrong Answer: Query(222, 254) - expected : 34031541, actual : 142375311. |
2 |
Incorrect |
122 ms |
2428 KB |
Wrong Answer: Query(60, 375) - expected : 669221184, actual : 904081859. |
3 |
Incorrect |
112 ms |
2468 KB |
Wrong Answer: Query(211, 401) - expected : 674373968, actual : 480958564. |
4 |
Incorrect |
434 ms |
4432 KB |
Wrong Answer: Query(90, 497) - expected : 397934825, actual : 68893621. |
5 |
Incorrect |
417 ms |
4356 KB |
Wrong Answer: Query(587, 915) - expected : 752404486, actual : 733462529. |
6 |
Incorrect |
430 ms |
4248 KB |
Wrong Answer: Query(915, 915) - expected : 282904741, actual : 288640176. |
7 |
Incorrect |
424 ms |
4332 KB |
Wrong Answer: Query(84, 976) - expected : 742463504, actual : 494770285. |
8 |
Incorrect |
443 ms |
4356 KB |
Wrong Answer: Query(58, 987) - expected : 20022464, actual : 715572888. |
9 |
Incorrect |
423 ms |
4432 KB |
Wrong Answer: Query(33, 967) - expected : 676869696, actual : 828580641. |
10 |
Incorrect |
438 ms |
4316 KB |
Wrong Answer: Query(116, 961) - expected : 68487362, actual : 157239790. |