Submission #876049

#TimeUsernameProblemLanguageResultExecution timeMemory
876049Elvin_FritlHorses (IOI15_horses)C++17
34 / 100
26 ms21844 KiB
#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 ind=0; for(int i=0;i<n;i++){ curr += xlog[i]; if(mx < curr + ylog[i]){ mx = curr + ylog[i]; ind = i; } } ll res=1; for(int i=0;i<=ind;i++){ res *= x[i]; res %= mod; } return (res*y[ind])%mod; } int init(int nn,int X[],int Y[]){ n=nn; for(int i=0;i<n;i++){ x[i]=X[i]; xlog[i] = log(x[i]); y[i]=Y[i]; ylog[i] = log(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)

horses.cpp: In function 'int calc()':
horses.cpp:29:24: warning: conversion from 'll' {aka 'long long int'} to 'int' may change value [-Wconversion]
   29 |     return (res*y[ind])%mod;
      |            ~~~~~~~~~~~~^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...