# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
310593 | juggernaut | Horses (IOI15_horses) | C++14 | 16 ms | 8448 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;
ll x[1005],y[1005],n,mod=1e9+7;
ll solve(){
ll res=1,i,cnt=1;
double lg=0,ans=0;
for(i=0;i<n;i++){
cnt=(cnt*x[i])%mod;
lg+=log(x[i]);
if(lg+log2(y[i])>ans){
ans=lg+log(y[i]);
res=(cnt*y[i])%mod;
}
}
return res;
}
int init(int N,int X[],int Y[]){
n=N;
copy(X,X+n,x);
copy(Y,Y+n,y);
return solve();
}
int updateX(int pos,int val){
x[pos]=val;
return solve();
}
int updateY(int pos,int val){
y[pos]=val;
return solve();
}
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... |