#include "horses.h"
#include <bits/stdc++.h>
// mrrrrrowww :333
// this is not an ad for vivid/stasis, but you should play vivid/stasis! (it's free (steam is the official source))
#define ll long long
using namespace std;
int n, *x, *y;
int solve() {
long long res = 0;
vector<long long> b = {0};
for (int i = 0; i < n; i++) {
vector<long long> nb(b.size() * x[i]);
for (int j = 1; j <= b.size(); j++) {
res = max(res, (b[j - 1] + j * x[i] * y[i]) % 1000000007);
for (int k = 0; k < j * x[i]; k++) res = max(res, nb[k] = max(nb[k], (b[j - 1] + (j * x[i] - k - 1) * y[i]) % 1000000007));
}
b = nb;
}
return res;
}
int init(int N, int X[], int Y[]) {
n = N, x = X, y = Y;
return solve();
}
int updateX(int pos, int val) {
x[pos] = val;
return solve();
}
int updateY(int pos, int val) {
y[pos] = val;
return solve();
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |