# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
876046 | Elvin_Fritl | Horses (IOI15_horses) | C++17 | 17 ms | 19796 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>
using namespace std;
typedef long long ll;
const int N = 1e5 + 545 , inf = 1e9 + 199 , mod = 1e9 + 7;
#include "horses.h"
ll n , x[N] , y[N];
long double xlog[N] , ylog[N];
int calc(){
long double curr = 1 , mx = 0;
ll maxi=0;
for(int i=0;i<n;i++){
curr += xlog[i];
if(mx < curr + ylog[i]){
mx=curr + ylog[i];
maxi=i;
}
}
ll res=1;
for(int i=0;i<=maxi;i++){
res *= x[i];
res %= mod;
}
return (res*y[maxi])%mod;
}
int init(int N,int X[],int Y[]){
n=N;
for(int i=0;i<n;i++){
x[i]=X[i];
xlog[i]=log(x[i]);
y[i]=Y[i];
}
return calc();
}
int updateX(int pos,int val){
x[pos]=val;
xlog[pos] = log(x[pos]);
return calc();
}
int updateY(int pos,int val){
y[pos]=val;
ylog[pos] = log(y[pos]);
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... |