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

18909번 - Circles 스페셜 저지다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 512 MB19141473.684%

문제

Given an array of non-negative integers $s_1, \ldots, s_n$ with $n \geq 3,ドル let's call a sequence of $n$ non-negative numbers (not necessarily integers) $x_1, x_2, \ldots, x_n$ \textit{balanced} if for each $i,ドル the constraint $x_i + x_{i+1} \leq s_i$ is satisfied, where $x_{n+1}=x_1$.

Let's denote $f(s_1, s_2, \ldots, s_n)$ as the largest $x_1 + x_2 + \ldots + x_n$ among all balanced configurations of weights.

You are given an array of non-negative integers $a_1, a_2, \ldots, a_n$.

Find $n-2$ numbers: $f(a_1, a_2, a_3), f(a_1, a_2, a_3, a_4), \ldots, f(a_1, a_2, a_3, \ldots, a_n)$.

입력

The first line contains one integer $n$ (3ドル \leq n \leq 100,000円)$.

The second line contains $n$ integers $a_1, a_2, \ldots, a_n$ (0ドル \leq a_i \leq 100,000円$).

출력

Print $n-2$ numbers: $f(a_1, a_2, a_3), f(a_1, a_2, a_3, a_4), \ldots, f(a_1, a_2, a_3, \ldots, a_n)$.

Your answer will be considered correct if the relative or absolute error of all values in it is at most 10ドル^{-9}$.

제한

예제 입력 1

4
20 20 20 15

예제 출력 1

30.0 35

예제 입력 2

6
1 2 1 2 1 2

예제 출력 2

2 2 3 3

예제 입력 3

12
1 1 1 3 1 1 2 5 3 2 1 2

예제 출력 3

1.5 2 3 3 4 5 8 8 9 9

힌트

In the first example, for the prefix with three elements we can set values $\{10, 10, 10\},ドル for the next prefix we can set values $\{10.1, 9.9, 10.1, 4.9\}$.

출처

Contest > Open Cup > 2019/2020 Season > Stage 16: Grand Prix of Moscow C번

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

출처

대학교 대회

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

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