#include <bits/stdc++.h>
#include "secret.h"
using namespace std;
/*
int Secret(int x, int y) {
return min(x + 2 * (y / 2), (int)1e9);
}
*/
const int N = 1001;
vector<int> a(N);
int x[N][N];
void Init(int n, int A[]) {
for(int i = 0; i < n; i++) {
a[i] = A[i];
}
for(int i = n - 1 ; i >= 0; i--) {
int o = a[i];
x[i][i] = a[i];
for(int j = i + 1; j <= n; j++) {
x[i][j] = Secret(x[i][j - 1], a[j]);
}
}
}
int Query(int l, int r) {
return x[l][r];
}
/*
int main() {
int Q[4] = {1, 4, 7, 2};
Init(4, Q);
cout << Query(0, 3);
}
*/
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |