#include "secret.h"
#include<bits/stdc++.h>
const int MAXN = 1010;
int n;
long long value[MAXN][MAXN];
long long v[MAXN];
void dc(int ini, int fim){
if(ini == fim) {
value[ini][ini] = v[ini];
return;
}
int mid = (ini + fim) >> 1;
dc(ini, mid);
dc(mid + 1, fim);
for(int i = mid - 1; i >= ini; i--)
value[i][mid] = Secret(value[i + 1][mid], v[i]);
for(int i = mid + 2; i <= fim; i++)
value[mid + 1][i] = Secret(value[mid + 1][i - 1], v[i]);
}
long long getVal(int ini, int fim, int l, int r){
int mid = (ini + fim) >> 1;
if(l <= mid && r > mid)
return Secret(value[l][mid], value[mid + 1][r]);
if(r <= mid)
return getVal(ini, mid, l, r);
return getVal(mid + 1, fim, l, r);
}
void Init(int N, int A[]) {
n = N;
for(int i = 0; i < n; i++)
v[i] = A[i];
dc(0, n - 1);
}
int Query(int L, int R) {
return getVal(0, n - 1, L, R);
}
//g++ -o secret -O2 grader.cpp secret.cpp
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
132 ms |
4844 KB |
Wrong Answer: Query(222, 254) - expected : 34031541, actual : 268854015. |
2 |
Incorrect |
133 ms |
4844 KB |
Wrong Answer: Query(60, 375) - expected : 669221184, actual : 311474560. |
3 |
Incorrect |
135 ms |
4988 KB |
Wrong Answer: Query(211, 401) - expected : 674373968, actual : 353554500. |
4 |
Incorrect |
498 ms |
9788 KB |
Wrong Answer: Query(90, 497) - expected : 397934825, actual : 343081568. |
5 |
Incorrect |
497 ms |
9836 KB |
Wrong Answer: Query(587, 915) - expected : 752404486, actual : 957013316. |
6 |
Execution timed out |
20035 ms |
9708 KB |
Time limit exceeded |
7 |
Incorrect |
499 ms |
9836 KB |
Wrong Answer: Query(84, 976) - expected : 742463504, actual : 675449873. |
8 |
Incorrect |
496 ms |
9708 KB |
Wrong Answer: Query(58, 987) - expected : 20022464, actual : 273091792. |
9 |
Incorrect |
519 ms |
9772 KB |
Wrong Answer: Query(33, 967) - expected : 676869696, actual : 827853577. |
10 |
Incorrect |
513 ms |
9708 KB |
Wrong Answer: Query(116, 961) - expected : 68487362, actual : 337854787. |