# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
918764 | Aiperiii | Horses (IOI15_horses) | C++14 | 0 ms | 0 KiB |
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;
#define int long long
#define ff first
#define ss second
#define pb push_back
#define all(x) x.begin(),x.end()
const int mod=1e9+7;
vector <int> x,y;
int init(int N, int X[], int Y[]) {
x.pb(0);y.pb(0);
for(int i=0;i<N;i++){
x.pb(X[i]);
y.pb(Y[i]);
}
int d=1;
int mx=0;
int n=x.size()-1;
for(int i=1;i<=n;i++){
d*=x[i];
d%=mod;
mx=max(mx,(d*y[i])%mod);
}
return mx%mod;
}
int updateX(int pos,int val){
pos++;
x[pos]=val;
int d=1;
int mx=0;
int n=x.size()-1;
for(int i=1;i<=n;i++){
d*=x[i];
d%=mod;
mx=max(mx,(d*y[i])%mod);
}
return mx%mod;
}
int updateY(int pos,int val){
pos++;
y[pos]=val;
int d=1;
int mx=0;
int n=y.size()-1;
for(int i=1;i<=n;i++){
d*=x[i];
d%=mod;
mx=max(mx,(d*y[i])%mod);
}
return mx%mod;
}