This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll mod = 1e9 + 7;
int n;
vector<ll> C, P;
int solve() {
ll ans = 0;
ll prod = 1;
for(int i = 0; i < n; ++i) {
prod *= C[i];
ans = max(ans, prod * P[i]);
}
return int(ans % mod);
}
int init(int N, int X[], int Y[]) {
n = N;
C.resize(n);
P.resize(n);
for(int i = 0; i < n; ++i) C[i] = X[i];
for(int i = 0; i < n; ++i) P[i] = Y[i];
return solve();
}
int updateX(int pos, int val) {
C[pos] = val;
return solve();
}
int updateY(int pos, int val) {
P[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... |