#include <bits/stdc++.h>
#include "secret.h"
#define mid (l+r)/2
using namespace std;
int n, i, a[1010], d[1010][1010];
void init(int l, int r) {
if(l >= r) return;
for(int i = mid+1; i <= r; i++) d[mid][i] = Secret(d[mid][i-1], a[i]);
for(int i = mid-2; i >= l; i--) d[i][mid-1] = Secret(a[i], d[i+1][mid-1]);
init(l, mid-1);init(mid+1, r);
}
void Init(int N, int A[]) {
for(i = 0, n = N; i < n; i++) a[i] = A[i-1], d[i][i] = a[i];
init(0, N-1);
}
int query(int l, int r, int L, int R) {
if(L < mid && mid <= R) return Secret(d[L][mid-1],d[mid][R]);
if(L == mid) return d[mid][R];
if(mid < L) return query(mid+1, r, L, R);
return query(l, mid-1, L, R);
}
int Query(int L, int R) {
if(L == R) return a[L];
return query(0, n-1, L, R);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
174 ms |
4344 KB |
Wrong Answer: Query(222, 254) - expected : 34031541, actual : 22166791. |
2 |
Incorrect |
179 ms |
4580 KB |
Wrong Answer: Query(60, 375) - expected : 669221184, actual : 306225408. |
3 |
Incorrect |
178 ms |
4704 KB |
Wrong Answer: Query(211, 401) - expected : 674373968, actual : 629483540. |
4 |
Incorrect |
639 ms |
8532 KB |
Wrong Answer: Query(90, 497) - expected : 397934825, actual : 34079308. |
5 |
Incorrect |
645 ms |
8628 KB |
Wrong Answer: Query(587, 915) - expected : 752404486, actual : 542818560. |
6 |
Incorrect |
650 ms |
8628 KB |
Wrong Answer: Query(915, 915) - expected : 282904741, actual : 579799611. |
7 |
Incorrect |
744 ms |
8676 KB |
Wrong Answer: Query(84, 976) - expected : 742463504, actual : 772352096. |
8 |
Incorrect |
634 ms |
8676 KB |
Wrong Answer: Query(58, 987) - expected : 20022464, actual : 290455552. |
9 |
Incorrect |
634 ms |
8676 KB |
Wrong Answer: Query(33, 967) - expected : 676869696, actual : 164632041. |
10 |
Incorrect |
667 ms |
8676 KB |
Wrong Answer: Query(116, 961) - expected : 68487362, actual : 872638089. |