| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 158593 | oolimry | Horses (IOI15_horses) | C++14 | 1567 ms | 23800 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;
long long mod = 1000000007;
long long x[500005];
long long y[500005];
double lnx[500005];
double lny[500005];
int n;
long long answer(){
double acc = 0;
double best = 0;
int bestpos = 0;
for(int i = 0;i < n;i++){
acc += lnx[i];
//printf("%d %f\n",i,acc + lny[i]);
if(acc + lny[i] > best){
best = acc + lny[i];
bestpos = i;
}
}
long long value = 1;
for(int i = 0;i <= bestpos;i++){
value *= x[i];
value %= mod;
}
value *= y[bestpos];
value %= mod;
return value;
}
int init(int N, int X[], int Y[]) {
n = N;
for(int i = 0;i < N;i++){
x[i] = X[i];
y[i] = Y[i];
lnx[i] = (double)log((double)X[i]);
lny[i] = (double)log((double)Y[i]);
//printf("%f %f\n",lnx[i],lny[i]);
}
return answer();
}
int updateX(int pos, int val) {
x[pos] = val;
lnx[pos] = (double)log((double)x[pos]);
return answer();
}
int updateY(int pos, int val) {
y[pos] = val;
lny[pos] = (double)log((double)y[pos]);
return answer();
}
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... | ||||
