Submission #1099695

#TimeUsernameProblemLanguageResultExecution timeMemory
1099695dzhoz0Secret (JOI14_secret)C++17
30 / 100
371 ms4436 KiB
/* ghmt the cutie :3 UwU */ #include <bits/stdc++.h> #include "secret.h" using namespace std; #define INF 1e9 #define f first #define s second #define pii pair<int, int> #define vi vector<int> const int MAXN = 1000; const int LG = 9; int st[LG + 1][MAXN]; void Init(int n, int a[]) { for(int i = 1; i <= n; i++) st[0][i] = a[i - 1]; for(int j = 1; j <= LG; j++) for(int i = 1; i + (1 << j) - 1 <= n; i++) st[j][i] = Secret(st[j - 1][i], st[j - 1][i + (1 << (j - 1))]); } int Query(int l, int r) { l++, r++; int len = r - l + 1; int s = -INF; for(int j = 0; (1 << j) <= len; j++) { if(len >> j & 1) { if(s == -INF) s = st[j][l]; else s = Secret(s, st[j][l]); l = l + (1 << j); } } return s; }
#Verdict Execution timeMemoryGrader output
Fetching results...