# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
428277 | haxorman | 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 "bits/stdc++.h"
using namespace std;
const int mxN = 5e5 + 7;
const int MOD = 1e9 + 7;
int n;
long long x[mxN], y[mxN];
int init(int N, int X[], int Y[]) {
n = N;
for (int i = 0; i < n; ++i) {
x[i] = X[i];
y[i] = Y[i];
}
long long horses = 1 ans = 0;
for (int i = 0; i < n; ++i) {
horses *= x[i];
ans = max(ans, y[i] * horses);
ans %= MOD;
}
return ans;
}
int updateX(int pos, int val) {
x[pos] = val;
long long horses = 1 ans = 0;
for (int i = 0; i < n; ++i) {
horses *= x[i];
ans = max(ans, y[i] * horses);
ans %= MOD;
}
return ans;
}
int updateY(int pos, int val) {
y[pos] = val;
long long horses = 1 ans = 0;
for (int i = 0; i < n; ++i) {
horses *= x[i];
ans = max(ans, y[i] * horses);
ans %= MOD;
}
return ans;
}