Submission #719347

#TimeUsernameProblemLanguageResultExecution timeMemory
719347thimote75Horses (IOI15_horses)C++14
17 / 100
1558 ms19872 KiB
#include "horses.h" #include <bits/stdc++.h> using namespace std; const long double LMOD = log(1e9 + 7); int mod_exp (long double doub) { doub = fmod(doub, LMOD); return (int) round(exp(doub)); } vector<long double> lX; vector<long double> lY; int compute () { long double max_v = 0; long double sum_v = 0; for (int j = 0; j < lX.size(); j ++) { sum_v += lX[j]; max_v = max(max_v, sum_v + lY[j]); } return mod_exp(max_v); } int init(int N, int X[], int Y[]) { lX.resize(N); lY.resize(N); for (int i = 0; i < N; i ++) { lX[i] = log((long double) X[i]); lY[i] = log((long double) Y[i]); } return compute(); } int updateX(int pos, int val) { lX[pos] = log((long double) val); return compute(); } int updateY(int pos, int val) { lY[pos] = log((long double) val); return compute(); }

Compilation message (stderr)

horses.cpp: In function 'int compute()':
horses.cpp:21:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long double>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   21 |  for (int j = 0; j < lX.size(); j ++) {
      |                  ~~^~~~~~~~~~~
#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...