Submission #65618

#TimeUsernameProblemLanguageResultExecution timeMemory
65618daniel_02Horses (IOI15_horses)C++17
17 / 100
1563 ms8476 KiB
#include "horses.h" #include "bits/stdc++.h" #define ll long long using namespace std; const int MOD = 1e9 + 7; const int sz = 5e5 + 7; int n, x[sz], y[sz]; int init(int N, int X[], int Y[]) { long double h = 0; ll cur = 1; long double ans = 0; ll ans1; n = N; for (int i = 0; i < N; i++) { x[i] = X[i]; y[i] = Y[i]; h += log10(x[i]); cur = (cur * x[i]) % MOD; if (ans * 1.0 < h + log10(y[i])) { ans = log10(y[i]) + h; ans1 = (y[i] * 1LL * cur) % MOD; } } return (ans1 % MOD); } int updateX(int pos, int val) { x[pos] = val; return init(n, x, y); } int updateY(int pos, int val) { y[pos] = val; return init(n, x, y); }

Compilation message (stderr)

horses.cpp: In function 'int init(int, int*, int*)':
horses.cpp:35:18: warning: conversion to 'int' from 'long long int' may alter its value [-Wconversion]
     return (ans1 % MOD);
            ~~~~~~^~~~~~
horses.cpp:35:23: warning: 'ans1' may be used uninitialized in this function [-Wmaybe-uninitialized]
     return (ans1 % 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...