# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
800799 | Liudas | Horses (IOI15_horses) | C++17 | 1591 ms | 15944 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 <bits/stdc++.h>
#include "horses.h"
using namespace std;
vector<long long> X, Y;
int N;
int calc(){
double a = 0, t = 0;
int id = 0;
for(int i = 0; i < N; i ++){
t += log(X[i]);
if(t + log(Y[i]) > a){
a = t + log(Y[i]);
id = i;
}
}
long long ans = 1, MOD = 1e9 + 7;
ans *= Y[id];
for(int i = 0; i <= id; i ++){
ans = ans * X[i] % MOD;
}
return ans;
}
int init(int NN, int XX[], int YY[]){
N = NN;
X.resize(N);
Y.resize(N);
for(int i = 0; i < N; i ++){
X[i] = XX[i];
Y[i] = YY[i];
}
return calc();
}
int updateX(int pos, int val){
X[pos] = val;
return calc();
}
int updateY(int pos, int val){
Y[pos] = val;
return calc();
}
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... |