| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1357141 | ezzzay | Horses (IOI15_horses) | C++20 | 0 ms | 0 KiB |
#include "horses.h"
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
using namespace std;
using ll = long long;
using boost::multiprecision::cpp_int;
static const ll MOD = 1000000007LL;
vector<ll> x, y;
static int calc() {
cpp_int pref = 1;
cpp_int best = 0;
for (int i = 0; i < (int)x.size(); ++i) {
pref *= x[i];
cpp_int cur = pref * y[i];
if (cur > best) best = cur;
}
ll ans = (best % MOD).convert_to<ll>();
return (int)ans;
}
int init(int N, int X[], int Y[]) {
x.assign(X, X + N);
y.assign(Y, Y + N);
return calc();
}
int updateX(int pos, int val) {
x[pos] = val;
return calc();
}
int updateY(int pos, int val) {
y[pos] = val;
return calc();
}