[Solution] Record Breaker Kick Start Session Solution - Kick Start 2022
Isyana is given the number of visitors at her local theme park on consecutive days. The number of visitors on the -th day is . A day is record breaking if it satisfies both of the following conditions:
- The number of visitors on the day is strictly larger than the number of visitors on each of the previous days.
- Either it is the last day, or the number of visitors on the day is strictly larger than the number of visitors on the following day.
Please help Isyana find out the number of record breaking days.
Input
The first line of the input gives the number of test cases, . test cases follow. Each test case begins with a line containing the integer . The second line contains integers. The -th integer is .
Output
For each test case, output one line containing Case #:
, where is the test case number (starting from ) and is the number of record breaking days.
Limits
Time limit: 20 seconds.
Memory limit: 1 GB.
1 ≤ T ≤ 100.
0 ≤ Vi ≤ 2 × 105.
Test Set 1
1 ≤ N ≤ 1000.
Test Set 2
1 ≤ N ≤ 2 × 105 for at most 10 test cases.
For the remaining cases, 1 ≤ N ≤ 1000.
In Sample Case #1, the underlined numbers in the following represent the record breaking days: 1 2 0 7 2 0 2 0.
In Sample Case #2, only the last day is a record breaking day: 4 8 15 16 23 42.
In Sample Case #3, the first, the third, and the sixth days are record breaking days: 3 1 4 1 5 9 2 6 5.
In Sample Case #4, there is no record breaking day: 9 9 9 9 9 9.
No comments:
Post a Comment