Submission #204766

#TimeUsernameProblemLanguageResultExecution timeMemory
204766TAISA_Horses (IOI15_horses)C++14
34 / 100
31 ms12280 KiB
#include "horses.h" #include <bits/stdc++.h> using namespace std; using ll=long long; int x[500000],y[500000]; int n; const ll mod=1000000007LL; int calc(){ vector<ll> s(n); s[0]=x[0]; for(int i=1;i<n;i++){ s[i]=s[i-1]*x[i]%mod; } ll id=n-1,t=x[n-1]; for(int i=n-2;i>=0;i--){ if(y[i]>t*y[id]){ id=i; t=1; } t*=x[i]; if(t>=mod){ break; } } return y[id]*s[id]%mod; } int init(int N, int X[], int Y[]) { n=N; assert(n<=1000); for(int i=0;i<n;i++){ x[i]=X[i]; y[i]=Y[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)

horses.cpp: In function 'int calc()':
horses.cpp:25:20: warning: conversion to 'int' from '__gnu_cxx::__alloc_traits<std::allocator<long long int> >::value_type {aka long long int}' may alter its value [-Wconversion]
  return y[id]*s[id]%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...