Maximise Subsequence Value SOLUTIONS MVAL

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:

March Long Challenge 2021 Solutions

April Long Challenge 2021 Solutions

Codechef Long Challenge Solutions

February Long Challenge 2021

1. Frog Sort Solution Codechef

2. Chef and Meetings Solution Codechef

3. Maximise Function Solution Codechef

4. Highest Divisor Solution Codechef

5. Cut the Cake Challenge Solution Codechef

6. Dream and the Multiverse Solution Codechef

7. Cell Shell Solution Codechef

8. Multiple Games Solution Codechef

9. Another Tree with Number Theory Solution Codechef

10. XOR Sums Solution Codechef

11. Prime Game Solution CodeChef

12. Team Name Solution Codechef

January Long Challenge 2021

November Challenge 2020 SOLUTION CodeChef

October Lunchtime 2020 CodeChef SOLUTIONS

RELATED :

Related :

Related :

Leave a Comment