이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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 ind=0;
for(int i=0;i<n;i++){
curr += xlog[i];
if(mx < curr + ylog[i]){
mx = curr + ylog[i];
ind = i;
}
}
ll res=1;
for(int i=0;i<=ind;i++){
res *= x[i];
res %= mod;
}
return (res*y[ind])%mod;
}
int init(int nn,int X[],int Y[]){
n=nn;
for(int i=0;i<n;i++){
x[i]=X[i];
xlog[i] = log(x[i]);
y[i]=Y[i];
ylog[i] = log(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:24: warning: conversion from 'll' {aka 'long long int'} to 'int' may change value [-Wconversion]
29 | return (res*y[ind])%mod;
| ~~~~~~~~~~~~^~~~
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |