#include "secret.h"
#define N 1005
int n, *a, st[11][N];
void Init(int n_, int *a_)
{
n = n_; a = a_;
for (int i = 0; i < n; ++i) st[0][i] = a[i];
for (int h = 1; (1 << h) <= n; ++h)
{
for (int j = 0; j < n; ++j)
{
if (j + (1 << h) > n) continue;
st[h][j] = Secret(st[h-1][j], st[h-1][j+(1<<(h-1))]);
}
}
}
int Query(int l, int r)
{
int z = a[l++];
for (int h = 10; h >= 0; --h)
{
if ((1 << h) <= r-l+1)
{
z = Secret(z, st[h][l]);
l += 1 << h;
}
}
return z;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Partially correct |
122 ms |
3668 KB |
Output is partially correct - number of calls to Secret by Init = 3586, maximum number of calls to Secret by Query = 8 |
2 |
Partially correct |
126 ms |
3724 KB |
Output is partially correct - number of calls to Secret by Init = 3595, maximum number of calls to Secret by Query = 8 |
3 |
Partially correct |
122 ms |
3472 KB |
Output is partially correct - number of calls to Secret by Init = 3604, maximum number of calls to Secret by Query = 8 |
4 |
Partially correct |
380 ms |
4436 KB |
Output is partially correct - number of calls to Secret by Init = 7978, maximum number of calls to Secret by Query = 9 |
5 |
Partially correct |
380 ms |
4188 KB |
Output is partially correct - number of calls to Secret by Init = 7987, maximum number of calls to Secret by Query = 9 |
6 |
Partially correct |
360 ms |
4432 KB |
Output is partially correct - number of calls to Secret by Init = 7987, maximum number of calls to Secret by Query = 3 |
7 |
Partially correct |
392 ms |
4212 KB |
Output is partially correct - number of calls to Secret by Init = 7987, maximum number of calls to Secret by Query = 9 |
8 |
Partially correct |
397 ms |
4180 KB |
Output is partially correct - number of calls to Secret by Init = 7987, maximum number of calls to Secret by Query = 9 |
9 |
Partially correct |
390 ms |
4436 KB |
Output is partially correct - number of calls to Secret by Init = 7987, maximum number of calls to Secret by Query = 8 |
10 |
Partially correct |
401 ms |
4428 KB |
Output is partially correct - number of calls to Secret by Init = 7987, maximum number of calls to Secret by Query = 9 |