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 "horses.h"
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mod 1000000007
int Y[500005];
int X[500005];
ll product[500005];
int n;
int init(int N, int y[], int x[]) {
n=N;
for(int i=0;i<n;i++){
X[i]=x[i];
Y[i]=y[i];
}
ll maximum=0;
product[0]=X[0];
maximum=X[0]*Y[0];
for(int i=1;i<n;i++){
product[i]=product[i-1]*X[i];
maximum=max(maximum,(ll)product[i]*(ll)Y[i]);
}
return (int)maximum%mod;
}
int updateX(int pos, int val) {
ll maximum=0;
X[pos]=val;
product[0]=X[0];
maximum=X[0]*Y[0];
for(int i=1;i<n;i++){
product[i]=product[i-1]*X[i];
maximum=max(maximum,(ll)product[i]*(ll)Y[i]);
}
return (int)maximum%mod;
}
int updateY(int pos, int val) {
ll maximum=0;
Y[pos]=val;
product[0]=X[0];
maximum=X[0]*Y[0];
for(int i=1;i<n;i++){
product[i]=product[i-1]*X[i];
maximum=max(maximum,(ll)product[i]*(ll)Y[i]);
}
return (int)maximum%mod;
}
# | 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... |