# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
719347 | thimote75 | Horses (IOI15_horses) | C++14 | 1558 ms | 19872 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 long double LMOD = log(1e9 + 7);
int mod_exp (long double doub) {
doub = fmod(doub, LMOD);
return (int) round(exp(doub));
}
vector<long double> lX;
vector<long double> lY;
int compute () {
long double max_v = 0;
long double sum_v = 0;
for (int j = 0; j < lX.size(); j ++) {
sum_v += lX[j];
max_v = max(max_v, sum_v + lY[j]);
}
return mod_exp(max_v);
}
int init(int N, int X[], int Y[]) {
lX.resize(N);
lY.resize(N);
for (int i = 0; i < N; i ++) {
lX[i] = log((long double) X[i]);
lY[i] = log((long double) Y[i]);
}
return compute();
}
int updateX(int pos, int val) {
lX[pos] = log((long double) val);
return compute();
}
int updateY(int pos, int val) {
lY[pos] = log((long double) val);
return compute();
}
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... |