// 0 indexed btw
#include "horses.h"
#include <bits/stdc++.h>
using namespace std;
#define lint long long
#define arr array
const int N = 5e5 + 5;
const lint MD = 1e9 + 7;
int n;
arr<lint, N> grw, prc;
lint md(lint x) { return (x + MD) % MD; }
int init(int _n, int _grw[], int _prc[]) {
n = _n;
for (int i = 1; i <= n; i++) grw[i] = _grw[i - 1], prc[i] = _prc[i - 1];
lint cr = 1, ans = 0;
for (int i = 1; i <= n; i++) {
cr = md(cr * grw[i]);
ans = max(ans, md(cr * prc[i]));
}
return ans;
}
int updateX(int id, int vl) {
id++, grw[id] = vl;
lint cr = 1, ans = 0;
for (int i = 1; i <= n; i++) {
cr = md(cr * grw[i]);
ans = max(ans, md(cr * prc[i]));
}
return ans;
}
int updateY(int id, int vl) {
id++, prc[id] = vl;
lint cr = 1, ans = 0;
for (int i = 1; i <= n; i++) {
cr = md(cr * grw[i]);
ans = max(ans, md(cr * prc[i]));
}
return ans;
}
# | 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... |