CF1195C.Basketball Exercise
普及/提高-
通过率:0%
时间限制:2.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
Finally, a basketball court has been opened in SIS, so Demid has decided to hold a basketball exercise session. 2⋅n students have come to Demid's exercise session, and he lined up them into two rows of the same size (there are exactly n people in each row). Students are numbered from 1 to n in each row in order from left to right.

Now Demid wants to choose a team to play basketball. He will choose players from left to right, and the index of each chosen player (excluding the first one taken) will be strictly greater than the index of the previously chosen player. To avoid giving preference to one of the rows, Demid chooses students in such a way that no consecutive chosen students belong to the same row. The first student can be chosen among all 2n students (there are no additional constraints), and a team can consist of any number of students.
Demid thinks, that in order to compose a perfect team, he should choose students in such a way, that the total height of all chosen students is maximum possible. Help Demid to find the maximum possible total height of players in a team he can choose.
最后,SIS学校新建了一个篮球场,因此德米德决定组织一场篮球训练课。共有 2⋅n 名学生参加了德米德的训练课,他将这些学生排成两行,每行恰好有 n 人。
每行的学生从左到右依次编号为 1 到 n。

现在,德米德希望从中选出一支篮球队。他将从左到右依次选择队员,且每个被选中的队员(除第一个外)的编号必须严格大于前一个被选中队员的编号。为了不偏袒某一行,德米德要求:任意两个相邻被选中的队员不能来自同一行。第一个队员可从全部 2n 名学生中任选(无其他限制),且所组成的队伍人数可以是任意非负整数(包括零人,但此时总身高为 0)。
德米德认为,要组成一支“完美”的队伍,应使得所选队员的总身高尽可能大。请帮助德米德求出他所能选出的队伍的最大可能总身高。
输入格式
The first line of the input contains a single integer n (1≤n≤105) — the number of students in each row.
The second line of the input contains n integers h1,1,h1,2,…,h1,n (1≤h1,i≤109), where h1,i is the height of the i-th student in the first row.
The third line of the input contains n integers h2,1,h2,2,…,h2,n (1≤h2,i≤109), where h2,i is the height of the i-th student in the second row.
输入的第一行包含一个整数 n(1≤n≤105)—— 表示每排的学生人数。
输入的第二行包含 n 个整数 h1,1,h1,2,…,h1,n(1≤h1,i≤109),其中 h1,i 表示第一排第 i 个学生的身高。
输入的第三行包含 n 个整数 h2,1,h2,2,…,h2,n(1≤h2,i≤109),其中 h2,i 表示第二排第 i 个学生的身高。
输出格式
Print a single integer — the maximum possible total height of players in a team Demid can choose.
输出一个整数——Demid 能选择的队伍中球员总身高的最大可能值。
输入输出样例
输入#1
5 9 3 5 7 3 5 8 1 4 5
输出#1
29
输入#2
3 1 2 9 10 1 1
输出#2
19
输入#3
1 7 4
输出#3
7
说明/提示
In the first example Demid can choose the following team as follows:

In the second example Demid can choose the following team as follows:

在第一个例子中,德米德可以如下选择队伍:

在第二个例子中,德米德可以如下选择队伍:

输入解题思路,AI测评打分。不知道怎么写?