Logo
(追記) (追記ここまで)

16760번 - Balance Beam 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 512 MB6731289616.991%

문제

In order to save money for a new stall in her barn, Bessie the cow has started performing in the local circus, demonstrating her remarkable sense of balance as she carefully walks back and forth on an elevated balance beam!

The amount of money Bessie earns in her performance is related to where she manages to ultimately jump off the beam. The beam has positions labeled 0,ドル 1, \ldots, N+1$ from left to right. If Bessie ever reaches 0ドル$ or $N+1$ she falls off one of the ends of the beam and sadly gets no payment.

If Bessie is at a given position $k,ドル she can do either of the following:

  1. Flip a coin. If she sees tails, she goes to position $k-1,ドル and if she sees heads, she goes to position $k + 1$ (i.e. $\frac{1}{2}$ probability of either occurrence).
  2. Jump off the beam and receive payment of $f(k)$ $(0 \leq f(k) \leq 10^9)$.

Bessie realizes that she may not be able to guarantee any particular payment outcome, since her movement is governed by random coin flips. However, based on the location where she starts, she wants to determine what her expected payment will be if she makes an optimal sequence of decisions ("optimal" meaning that the decisions lead to the highest possible expected payment). For example, if her strategy earns her payment of 10ドル$ with probability 1ドル/2,ドル 8ドル$ with probability 1ドル/4,ドル or 0ドル$ with probability 1ドル/4,ドル then her expected payment will be the weighted average 10ドル(1/2) + 8(1/4) + 0(1/4) = 7$.

입력

The first line of input contains $N$ (2ドル \leq N \leq 10^5$). Each of the remaining $N$ lines contain $f(1) \ldots f(N)$.

출력

Output $N$ lines. On line $i,ドル print out 10ドル^5$ times the expected value of payment if Bessie starts at position $i$ and plays optimally, rounded down to the nearest integer.

제한

예제 입력 1

2
1
3

예제 출력 1

150000
300000

힌트

출처

Olympiad > USA Computing Olympiad > 2018-2019 Season > USACO 2018 December Contest > Platinum 1번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /