Submission #366594

#TimeUsernameProblemLanguageResultExecution timeMemory
366594idk321Secret (JOI14_secret)C++11
30 / 100
610 ms4672 KiB
#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 timeMemoryGrader output
Fetching results...