# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
366594 | idk321 | Secret (JOI14_secret) | C++11 | 610 ms | 4672 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |