Submission #65625

#TimeUsernameProblemLanguageResultExecution timeMemory
65625daniel_02Horses (IOI15_horses)C++17
34 / 100
1571 ms14860 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 = 1; 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);
            ~~~~~~^~~~~~
#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...