# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
466789 | Carmel_Ab1 | Horses (IOI15_horses) | C++17 | 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 "horses.h"
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
#include "grader.cpp"
const ll mod=1e9+7;
ll has=1,ans=0;
vl x,y;
int init(int n, int X[], int Y[]) {
x.resize(n);
y.resize(n);
for(int i=0; i<n; i++)
x[i]=X[i],y[i]=Y[i];
for(int i=0; i<n; i++){
has*=x[i];
has%=mod;
ans=max(ans,(has*y[i])%mod);
}
return int(ans);
}
int updateX(int pos, int val) {
x[pos]=val;
has=1,ans=0;
int n=x.size();
for(int i=0; i<n; i++){
has*=x[i];
has%=mod;
ans=max(ans,(has*y[i])%mod);
}
return int(ans);
}
int updateY(int pos, int val) {
y[pos]=val;
has=1,ans=0;
int n=x.size();
for(int i=0; i<n; i++){
has*=x[i];
has%=mod;
ans=max(ans,(has*y[i])%mod);
}
return int(ans);
}