# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
298953 | Azimjon | Horses (IOI15_horses) | C++17 | 1579 ms | 14420 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<ll, ll> pll;
typedef vector<ll> vll;
const ll INF = 1e18;
const ll mod = 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, -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;
}
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;
}
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;
}
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... |