# Maximise Subsequence Value SOLUTIONS MVAL

Page Contents

### Maximise Subsequence Value SOLUTIONS MVAL

You are given an arrangement \$A_1, A_2, ldots, A_N\$. You should choose a (not really bordering) aftereffect of \$A\$ and converse it. At the end of the day, in the event that you select an aftereffect \$A_{i_1}, A_{i_2}, ldots, A_{i_K}\$ (\$1 le i_1 lt ldots lt i_K le N\$), at that point for each substantial \$j\$, the \$i_j\$-th component of the subsequent succession is equivalent to the \$i_{K+1-j}\$-th component of the first grouping; all different components are equivalent to in the first arrangement.

In the subsequent grouping, you need to ascertain the greatest total of a coterminous aftereffect (perhaps a vacant arrangement, with aggregate \$0\$). Locate its greatest conceivable worth and an aftereffect which you should choose so as to get this most extreme worth. On the off chance that there are numerous arrangements, you may locate any of them.

Information

The primary line of the info contains a solitary whole number \$T\$ indicating the quantity of experiments. The depiction of \$T\$ experiments follows.

The principal line of each experiment contains a solitary whole number \$N\$.

The subsequent line contains \$N\$ space-isolated numbers \$A_1, A_2, ldots, A_N\$.

Yield

For each experiment, print two lines.

The first of these lines ought to contain a solitary whole number ― the greatest conceivable entirety of a coterminous aftereffect.

The subsequent line ought to contain a number \$K\$ followed by a space and \$K\$ space-isolated numbers \$i_1, i_2, ldots, i_K\$.

Limitations

\$1 le T le 2,000\$

\$2 le N le 10^5\$

\$|A_i| le 10^9\$ for each substantial \$i\$

the entirety of \$N\$ over all experiments doesn’t surpass \$2 cdot 10^6\$

Model Input

– 4 2 – 4 3 – 5

– 3 – 2 – 1

Model Output

2 3

0

Related: