# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1099695 | dzhoz0 | Secret (JOI14_secret) | C++17 | 371 ms | 4436 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.
/*
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 time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |