| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 342212 | blue | Secret (JOI14_secret) | C++11 | 588 ms | 4600 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 "secret.h"
using namespace std;
int res[1000][11];
void Init(int N, int A[])
{
for(int i = 0; i < N; i++) res[i][0] = A[i];
for(int exp = 1; (1 << exp) <= N; exp++)
{
for(int i = 0; i + (1 << exp) - 1 < N; i++)
{
res[i][exp] = Secret(res[i][exp - 1], res[i + (1 << (exp-1))][exp - 1]);
}
}
}
int Query(int L, int R)
{
int query_res = -1;
int s = (R - L + 1);
for(int exp = 10; exp >= 0; exp--)
{
if((R-L+1) & (1 << exp))
{
if(query_res == -1) query_res = res[L][exp];
else query_res = Secret(query_res, res[L][exp]);
L = L + (1 << exp);
}
}
return query_res;
}
Compilation message (stderr)
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
