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

23107번 - Efficient Partitioning 다국어

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

문제

Let a partition of $[0, N)$ be an integer sequence $S = (s_0, \ldots, s_r$) that satisfies the following three conditions:

  • $s_0 = 0,ドル
  • $s_r = N,ドル
  • $s_i < s_{i + 1}$ (0ドル \le i < r$).

That is, for each $i,ドル $[s_i, s_i + 1)$ represents a continuous interval, and $[0, N)$ is the union of these $r$ intervals.

Given are three sequences of length $N$ consisting of integers between $-10^9$ and 10ドル^9$: $A$ ($a_0, \ldots, a_{N-1}$), $B$ ($b_0, \ldots, b_{N-1}$), $C$ ($c_0, \ldots, c_{N-1}$).

Let the score of partition $S$ be $f(S)$ defined as follows:

$$ f(S)=\min_{0 \leq i < r}\left\{b_{s_i}+c_{s_{i+1}-1}+\sum_{s_i \leq j < s_{i+1}} a_j\right\} $$

Find the maximum value of $f$ over all possible partitions $S$.

입력

The first line of input contains one integer $N$ (1ドル \le N \le 2 \cdot 10^5$). The second line contains $n$ integers: $i$-th of them denotes $a_i$. The third and fourth lines describe the sequences $b$ and $c$ in the same format ($-10^9 \le a_i, b_i, c_i \le 10^9$).

출력

Print one integer: the maximum score over all possible partitions.

제한

예제 입력 1

2
1 -1
-1 4
1 -2

예제 출력 1

1

예제 입력 2

1
1000000000
1000000000
1000000000

예제 출력 2

3000000000

힌트

출처

Camp > Petrozavodsk Programming Camp > Summer 2021 > Day 1: Kyoto U Contest 1 E번

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

출처

대학교 대회

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

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