#include "secret.h"
#include<bits/stdc++.h>
using namespace std;
#define NN 1005
#define K 15
int lf[K][NN], rt[K][NN], n;
void divi(int lv, int l, int r, int A[]){
if (l == r){
lf[lv][l] = A[l - 1];
return;
}
int mid = (l + r) >> 1;
lf[lv][mid] = A[mid - 1];
for (int i = mid - 1; i >= l; i--){
lf[lv][i] = Secret(A[i - 1], lf[lv][i + 1]);
}
rt[lv][mid + 1] = A[mid];
for (int i = mid + 2; i <= r; i++){
rt[lv][i] = Secret(A[i - 1], rt[lv][i - 1]);
}
divi(lv + 1, l, mid, A);
divi(lv + 1, mid + 1, r, A);
}
int get(int lv, int l, int r, int u, int v){
int mid = (l + r) >> 1;
if (u <= mid && r >= mid){
int rtt = lf[lv][u];
if (v > mid) rtt = Secret(rtt, rt[lv][v]);
return rtt;
}
if (v < mid) return get(lv + 1, l, mid, u, v);
return get(lv + 1, mid + 1, r, u, v);
}
void Init(int N, int A[]){
n = N;
divi(0, 1, n, A);
}
int Query(int L, int R){
L++; R++;
return get(0, 1, n, L, R);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
66 ms |
2652 KB |
Wrong Answer: Query(222, 254) - expected : 34031541, actual : 587620239. |
2 |
Incorrect |
67 ms |
2872 KB |
Wrong Answer: Query(60, 375) - expected : 669221184, actual : 68749376. |
3 |
Incorrect |
70 ms |
2896 KB |
Wrong Answer: Query(211, 401) - expected : 674373968, actual : 136349820. |
4 |
Incorrect |
254 ms |
4432 KB |
Wrong Answer: Query(90, 497) - expected : 397934825, actual : 846921768. |
5 |
Incorrect |
268 ms |
4432 KB |
Wrong Answer: Query(587, 915) - expected : 752404486, actual : 377506838. |
6 |
Incorrect |
261 ms |
4432 KB |
Wrong Answer: Query(915, 915) - expected : 282904741, actual : 546595440. |
7 |
Incorrect |
263 ms |
4436 KB |
Wrong Answer: Query(84, 976) - expected : 742463504, actual : 687550570. |
8 |
Incorrect |
274 ms |
4432 KB |
Wrong Answer: Query(58, 987) - expected : 20022464, actual : 145923264. |
9 |
Incorrect |
257 ms |
4440 KB |
Wrong Answer: Query(33, 967) - expected : 676869696, actual : 18757135. |
10 |
Incorrect |
255 ms |
4436 KB |
Wrong Answer: Query(116, 961) - expected : 68487362, actual : 70590726. |