2.1 CatFish
(RankList for this Question)
Score: 20pts
Time Limit: 5.00 sec
Inara and Maya are two stray cats and every night Izumi gives them fishes. Izumi likes to play a game with them by placing n fishes in a line. Inara and Maya start eating the fishes from opposite directions. Inara starts eating fishes one by one from left to right and Maya from right to left. Time taken by both the cats to eat is given by the a[i]. When one cat finishes eating a fish, it immediately starts eating another one. Izumi does not allow the cats to eat multiple fishes at the same time, or to leave the fish unfinished. The cats are not allowed to pause while eating as well. If both cats start to eat the same fish simultaneously then Izumi allows Inara to finish eating the fish.

How many fishes will Inara and Maya both consume?

1 <= t <= 100
1 <= n <= 10^5
1 <= a[i] <= 1000

Input Format
The first line contains the number of test cases t

For each test case:
The first line contains the number of fishes n
The next line contains the number of fishes a[i] separated by spaces

Output Format
For each test case there would be a line having output in the following format:
x (number of fishes eaten by Inara) y (number of fishes eaten by Maya)

Example 1
2 2 1 9 2 2

3 3

Both Inara and Maya eat two fishes with equal speed and hence they both are able to eat the third fish. If Maya’s speed for eating fishes were greater than that of Inara’s then the number of fishes eaten by Maya would be greater.

Log In to solve the Question