#include <bits/stdc++.h>
#include "secret.h"
using namespace std;
const int INF = 1e9;
const int MXN = 1000;
int st[10][MXN], mask[MXN], a[MXN], n;
void dnc(int l, int r, int lev){
if(l == r)
return;
int mid = (l + r) >> 1;
for(int i = mid; i >= l; --i)
st[lev][i] = Secret(a[i], st[lev][i+1]);
st[lev][mid+1] = a[mid+1];
for(int i = mid+2; i <= r; i++)
st[lev][i] = Secret(st[lev][i-1], a[i]);
for(int i = mid + 1; i <= r; i++)
mask[i] ^= (1 << lev);
dnc(l, mid, lev+1), dnc(mid+1, r, lev+1);
}
void Init(int N, int A[]){
n = N;
for(int i = 0; i < n; i++)
a[i] = A[i];
dnc(0, n-1, 0);
}
int Query(int L, int R){
int level = __builtin_ctz(mask[L]^mask[R]);
return Secret(st[level][L], st[level][R]);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
133 ms |
2540 KB |
Wrong Answer: Query(222, 254) - expected : 34031541, actual : 34031537. |
2 |
Incorrect |
135 ms |
2540 KB |
Wrong Answer: Query(102, 157) - expected : 32612619, actual : 569483529. |
3 |
Incorrect |
133 ms |
2540 KB |
Wrong Answer: Query(67, 224) - expected : 202440844, actual : 739311628. |
4 |
Incorrect |
492 ms |
4460 KB |
Wrong Answer: Query(727, 872) - expected : 870334875, actual : 870334619. |
5 |
Incorrect |
490 ms |
4388 KB |
Wrong Answer: Query(761, 790) - expected : 112945480, actual : 112871752. |
6 |
Incorrect |
492 ms |
4460 KB |
Wrong Answer: Query(915, 915) - expected : 282904741, actual : 536870912. |
7 |
Partially correct |
505 ms |
4512 KB |
Output isn't correct - number of calls to Secret by Init = 8977, maximum number of calls to Secret by Query = 1 |
8 |
Partially correct |
506 ms |
4412 KB |
Output isn't correct - number of calls to Secret by Init = 8977, maximum number of calls to Secret by Query = 1 |
9 |
Partially correct |
502 ms |
4460 KB |
Output isn't correct - number of calls to Secret by Init = 8977, maximum number of calls to Secret by Query = 1 |
10 |
Partially correct |
501 ms |
4588 KB |
Output isn't correct - number of calls to Secret by Init = 8977, maximum number of calls to Secret by Query = 1 |