Sid is a superior salesperson. So he gets a task from his boss. The task is that he will be given some number of products say k (All the products are same) and he has to travel N cities [1...N] to sell them. The main objective of the task is that he has to try to sell the product at higher price than previous city. For example if he sells a product at 100 Rs in one city then he has to try to sell the next product greater than 100 Rs in the next city and so on.
He travels all the cities and write down all the selling amounts. Now He wants to calculate maximum number of cities in which he could follow this increasing trend. And the maximum total prime money he could make in those cities. Help him in finding this.
Note : Number of products will always be equal to number of cities.
The first line of input contains an integer T denoting the number of test cases. Then T test cases follow. First line of each test case starts with an integer N denoting the size of the array A. Next line of input contains N space separated integers.
For each test case, In new line print the maximum number of cities and maximum total prime money with one space.
4 2 3 5 1 6 7 8 9
2 3 5 7 4 1 6 5 4 8
2 2 2 2 2
For 1st test case
5 cities are maximum number of cities in which the trend followed, And amount in those cities were 1, 6, 7, 8, 9. Out of these amounts only 7 is prime money.
For 2nd test case
4 cities are maximum number of cities in which the trend followed, And amount in those cities were 2, 3, 5, 7. Out of these amounts, maximum total prime money is 2+3+5+7=17.
For 3rd test case
He was successful in one city only, And maximum total prime money is 2.
If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.