# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
299030 | Azimjon | Horses (IOI15_horses) | C++17 | 1542 ms | 12508 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 pair<long double, ll> pll;
typedef vector<ll> vll;
const ll INF = 1e18;
const ll mod = 1000000000000000007ll;
const ll mm = 1000000007ll;
vll x, y;
int n;
int init(int N, int X[], int Y[]) {
n = N;
for (int i = 0; i < n; i++) {
x.push_back(X[i]);
y.push_back(Y[i]);
}
pll h = {0., 1};
pll jv = {-INF * 1., -INF};
for (int i = 0; i < N; i++) {
h.second *= x[i];
h.first += h.second / mod;
h.second %= mod;
pll t = h;
t.second *= y[i];
t.first += t.second / mod;
t.second %= mod;
jv = max(t, jv);
}
return jv.second % mm;
}
int updateX(int pos, int val) {
x[pos] = val;
pll h = {0, 1};
pll jv = {-INF, -INF};
for (int i = 0; i < n; i++) {
h.second *= x[i];
h.first += h.second / mod;
h.second %= mod;
pll t = h;
t.second *= y[i];
t.first += t.second / mod;
t.second %= mod;
jv = max(t, jv);
}
return jv.second % mm;
}
int updateY(int pos, int val) {
y[pos] = val;
pll h = {0, 1};
pll jv = {-INF, -INF};
for (int i = 0; i < n; i++) {
h.second *= x[i];
h.first += h.second / mod;
h.second %= mod;
pll t = h;
t.second *= y[i];
t.first += t.second / mod;
t.second %= mod;
jv = max(t, jv);
}
return jv.second % mm;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |