#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#include "secret.h"
const int N = 1000;
int val[N][9];
void Init(int n, int a[])
{
for (int i = 0; i < n; i++)
{
val[i][0] = a[i];
}
for (int j = 1; j <= 8; j++)
{
for (int i = 0; i + (1 << j) - 1 <n; i++)
{
val[i][j] = Secret(val[i][j - 1], val[i + (1 << (j - 1))][j - 1]);
}
}
}
int Query(int l, int r)
{
int res = -1;
while (l <= r)
{
for (int j = 8; j >= 0; j--)
{
if (l + (1 << j) - 1 <= r)
{
if (res == -1) res = val[l][j];
else res = Secret(res, val[l][j]);
l += (1 << j);
break;
}
}
}
return res;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Partially correct |
164 ms |
2560 KB |
Output is partially correct - number of calls to Secret by Init = 3586, maximum number of calls to Secret by Query = 7 |
2 |
Partially correct |
162 ms |
2552 KB |
Output is partially correct - number of calls to Secret by Init = 3594, maximum number of calls to Secret by Query = 7 |
3 |
Partially correct |
164 ms |
2512 KB |
Output is partially correct - number of calls to Secret by Init = 3602, maximum number of calls to Secret by Query = 7 |
4 |
Partially correct |
557 ms |
4460 KB |
Output is partially correct - number of calls to Secret by Init = 7490, maximum number of calls to Secret by Query = 9 |
5 |
Partially correct |
573 ms |
4672 KB |
Output is partially correct - number of calls to Secret by Init = 7498, maximum number of calls to Secret by Query = 9 |
6 |
Partially correct |
503 ms |
4460 KB |
Output is partially correct - number of calls to Secret by Init = 7498, maximum number of calls to Secret by Query = 2 |
7 |
Partially correct |
558 ms |
4460 KB |
Output is partially correct - number of calls to Secret by Init = 7498, maximum number of calls to Secret by Query = 9 |
8 |
Partially correct |
567 ms |
4460 KB |
Output is partially correct - number of calls to Secret by Init = 7498, maximum number of calls to Secret by Query = 8 |
9 |
Partially correct |
610 ms |
4460 KB |
Output is partially correct - number of calls to Secret by Init = 7498, maximum number of calls to Secret by Query = 9 |
10 |
Partially correct |
571 ms |
4460 KB |
Output is partially correct - number of calls to Secret by Init = 7498, maximum number of calls to Secret by Query = 8 |