# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
353863 | antontsiorvas | 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 "horses.h"
#include <algorithm>
long long int x[500005], y[500005];
int init(int N, int X[], int Y[]) {
for(int i=0; i<N; i++){
x[i] = X[i];
y[i] = Y[i];
}
long long int horses=1;
long long int ret=0;
for(int i=0; i<N; i++){
horses *= x[i];
ret %= 1000000007;
horses %= 1000000007;
ret = std::max(ret, (horses*y[i])%1000000007);
}
int ret2 = ret;
return ret2;
}
int updateX(int pos, int val) {
x[pos] = val;
long long int horses=1;
long long int ret=0;
for(int i=0; i<N; i++){
horses *= x[i];
ret %= 1000000007;
horses %= 1000000007;
ret = std::max(ret, (horses*y[i])%1000000007);
}
int ret2 = ret;
return ret2;
}
int updateY(int pos, int val) {
y[pos] = val;
long long int horses=1;
long long int ret=0;
for(int i=0; i<N; i++){
horses *= x[i];
ret %= 1000000007;
horses %= 1000000007;
ret = std::max(ret, (horses*y[i])%1000000007);
}
int ret2 = ret;
return ret2;
}