RiseOJ는 solved.ac와 제휴 관계가 없습니다. 티어 아이콘 © solved.ac. solved.ac
포럼
USACO0348 파일 입출력

Balance Beam

Diamond V 다이아몬드 V
난이도
2s
시간 제한
256MB
메모리 제한
0
맞았습니다!!
0
제출 수
0.0%
정답률
레이팅

의견: 0

설명

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\).

Problem credits: Franklyn Wang and Spencer Compton

제약

Problem credits: Franklyn Wang and Spencer Compton

입력 형식

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.

파일 입력 / 출력
이 문제는 표준 입출력을 사용하지 않습니다. 프로그램은 다음 파일을 읽고 써야 합니다:
입력을 읽을 파일 balance.in
출력을 쓸 파일 balance.out
예제 1
입력
2
1
3
출력
150000
300000
문제 정보

riseoj 작성

출처 올림피아드 > USACO > 2018-2019 > December > Platinum

태그

평가 및 의견

Balance Beam

개요
출제자 난이도 Diamond V 다이아몬드 V 의견 0 / 50 공개 집계 (커뮤니티 난이도, 주요 주제, 품질)는 의견이 충분히 모이면 공개됩니다.

Log in to rate problems.

개별 의견

아직 의견이 없습니다. 자격이 된다면 위 양식에서 가장 먼저 평가해 보세요.

풀이 제출

Balance Beam

게스트로 둘러보고 있습니다. 로그인하면 풀이를 제출하고 진행 상황을 확인할 수 있습니다. 로그인하고 제출하기
공개
C++20 Tab 들여쓰기 · Ctrl+/ 주석 토글 · Enter 자동 들여쓰기
1 1 1 0 공백: 4 · UTF-8