Today more and more people have started mountain biking everyday. In Dehradoon, a race is organized every year for mountain biking lovers. As chef loves racing sport so he went to watch this year race. He noticed that one segment of the circuit was a long spiral road around the hills. The road of the circuit is so narrow, it is impossible for a bike to overtake another bike on this segment. Therefore, a bike had to lower down its speed if there is slower bike in front of it. While watching the race, chef started to wonder how many bikes were moving at their maximum speed in that segment.
You are given the maximum speed of N bike in the order they entered the long spiral segment of the circuit. Each bike prefers to move at its maximum speed. If that is not possible because of the front bike being slow, it might have to lower its speed. You can assume that the spiral segment is infinitely long.
But chef is busy in enjoying the race, so he gives you to count the number of bikes that are moving at their maximum speed in that spiral segment.
The first line contains a single integer T denoting the number of test cases.
Description of each test case contains 2 lines. The first line contains a single integer N, the number of bikes. The second line contains N space separated integer , denoting the maximum speed of the bike in the order they entered that segment.
For each test case, output a single line containing the number of bikes which are moving at their maximum speed.
- 1 ≤ T ≤ 100
- 1 ≤ N ≤ 105
3 2 1 4 3 7 2 5 5 3 4 1 2 3Output:
1 2 2
|Time Limit:||1 sec|
|Source Limit:||50000 Bytes|
|Languages:||C, CPP14, JAVA, PYTH, PYTH 3.6, PYP3|
Fetching successful submissions
If you are still having problems, see a sample solution here.