제출 #876046

#제출 시각아이디문제언어결과실행 시간메모리
876046Elvin_FritlHorses (IOI15_horses)C++17
0 / 100
17 ms19796 KiB
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;

const int N = 1e5 + 545 , inf = 1e9 + 199 , mod = 1e9 + 7;

     #include "horses.h"
 
ll n , x[N] , y[N];
long double xlog[N] , ylog[N];
 
int calc(){
    long double curr = 1 , mx = 0;
    ll maxi=0;
    for(int i=0;i<n;i++){
        curr += xlog[i];
        if(mx < curr + ylog[i]){
            mx=curr + ylog[i];
            maxi=i;
        }
    }
    
    ll res=1;
    for(int i=0;i<=maxi;i++){
        res *= x[i];
        res %= mod;
    }
    return (res*y[maxi])%mod;
}
 
int init(int N,int X[],int Y[]){
    n=N;
    for(int i=0;i<n;i++){
        x[i]=X[i];
        xlog[i]=log(x[i]);
        y[i]=Y[i];
    }
    return calc();
}
 
int updateX(int pos,int val){
    x[pos]=val;
    xlog[pos] = log(x[pos]);
    return calc();
}
 
int updateY(int pos,int val){
    y[pos]=val;
    ylog[pos] = log(y[pos]);
    return calc();
}

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

horses.cpp: In function 'int calc()':
horses.cpp:29:25: warning: conversion from 'll' {aka 'long long int'} to 'int' may change value [-Wconversion]
   29 |     return (res*y[maxi])%mod;
      |            ~~~~~~~~~~~~~^~~~
horses.cpp: In function 'int init(int, int*, int*)':
horses.cpp:32:14: warning: declaration of 'N' shadows a global declaration [-Wshadow]
   32 | int init(int N,int X[],int Y[]){
      |          ~~~~^
horses.cpp:6:11: note: shadowed declaration is here
    6 | const int N = 1e5 + 545 , inf = 1e9 + 199 , mod = 1e9 + 7;
      |           ^
#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...