| TheForces Round #19 (Briefest-Forces) |
|---|
| Закончено |
You're given a number circle $$$a$$$ of size $$$2n$$$($$$a_1$$$ is adjecent to $$$a_{2n}$$$).
You can perform the following operation exactly once:
After that,you can choose the sum of some consecutive numbers in $$$a$$$ as your score.Find your maximum score.
The first line of input will contain a single integer $$$t(1 \leq t \leq 10^5)$$$, denoting the number of test cases.
Each test case consists of two lines of input.
The first line contains an integer $$$n(1 \leq n \leq 1.5*10^6)$$$.
The second line contains $$$2n$$$ integers $$$a_1,a_2,...,a_{2n}(-10^9\leq a_i \leq 10^9)$$$.
The sum of $$$n$$$ will not exceed $$$1.5*10^6$$$.
For each test case,output on a new line —your maximum score.
4 3 -1 2 -3 -4 -5 6 3 -3 5 -2 6 4 -1 3 -2 -2 -2 -1 -2 -2 3 1 2 3 4 5 6
8 14 -1 21
Test case $$$1$$$:
Choose $$$k=2$$$,you'll get $$$a=\{-4,-5,-3,-1,2,6\}$$$.Then choose $$$a_5+a_6=2+6=8$$$ as you score.
Test case $$$2$$$:
Choose $$$k=1$$$,you'll get $$$a=\{6,5,-2,-3,4,-1\}$$$.Then choose $$$a_5+a_6+a_1+a_2=4-1+6+5=14$$$ as you score(note $$$a_1$$$ is adjecent to $$$a_{6}$$$).
| Название |
|---|


