제출 #927811

#제출 시각아이디문제언어결과실행 시간메모리
927811VMaksimoski008말 (IOI15_horses)C++14
0 / 100
1583 ms13752 KiB
#include <bits/stdc++.h> #include "horses.h" #define sz(x) (int)x.size() #define all(x) x.begin(), x.end() #define rall(x) x.rbegin(), x.rend() //#define int long long using namespace std; using ll = long long; using pii = pair<int, int>; using pll = pair<ll, ll>; const int mod = 1e9 + 7; const int maxn = 1e5 + 5; int n; vector<ll> X(5*maxn), Y(maxn); vector<double> logX(5*maxn), logY(maxn); int calc() { ll curr = 1, id = -1, ans = 0; ll ls = 0, p1 = 0; for(int i=0; i<n; i++) { curr = (curr * X[i]) % mod; ls += logX[i]; if(ls + logY[i] > ans) { ans = ls + logY[i]; id = i; p1 = curr; } } ll res = (p1 * Y[id]) % mod; return res; } int init(int N, int x[], int y[]) { n = N; for(int i=0; i<n; i++) { X[i] = x[i], Y[i] = y[i]; logX[i] = log10(X[i]), logY[i] = log10(y[i]); } return calc(); } int updateX(int p, int v) { X[p] = v; logX[p] = log10(v); return calc(); } int updateY(int p, int v) { logY[p] = log10(v); return calc(); }

컴파일 시 표준 에러 (stderr) 메시지

horses.cpp: In function 'int calc()':
horses.cpp:28:21: warning: conversion from 'll' {aka 'long long int'} to '__gnu_cxx::__alloc_traits<std::allocator<double>, double>::value_type' {aka 'double'} may change value [-Wconversion]
   28 |         ls += logX[i];
      |                     ^
horses.cpp:28:21: warning: conversion from '__gnu_cxx::__alloc_traits<std::allocator<double>, double>::value_type' {aka 'double'} to 'll' {aka 'long long int'} may change value [-Wfloat-conversion]
horses.cpp:29:12: warning: conversion from 'll' {aka 'long long int'} to '__gnu_cxx::__alloc_traits<std::allocator<double>, double>::value_type' {aka 'double'} may change value [-Wconversion]
   29 |         if(ls + logY[i] > ans) {
      |            ^~
horses.cpp:29:27: warning: conversion from 'll' {aka 'long long int'} to '__gnu_cxx::__alloc_traits<std::allocator<double>, double>::value_type' {aka 'double'} may change value [-Wconversion]
   29 |         if(ls + logY[i] > ans) {
      |                           ^~~
horses.cpp:30:19: warning: conversion from 'll' {aka 'long long int'} to '__gnu_cxx::__alloc_traits<std::allocator<double>, double>::value_type' {aka 'double'} may change value [-Wconversion]
   30 |             ans = ls + logY[i];
      |                   ^~
horses.cpp:30:22: warning: conversion from '__gnu_cxx::__alloc_traits<std::allocator<double>, double>::value_type' {aka 'double'} to 'll' {aka 'long long int'} may change value [-Wfloat-conversion]
   30 |             ans = ls + logY[i];
horses.cpp:38:12: warning: conversion from 'll' {aka 'long long int'} to 'int' may change value [-Wconversion]
   38 |     return res;
      |            ^~~
#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...