CompetitionStatistics
SRM 259 · 2005-08-22 · by Andrew_Lazarev
Problem Statement
The longest consecutive rating increase streak is a very important statistic in any competition. You are to calculate this statistic for a certain player.
You will be given a
Constraints
- ratingChanges will contain between 1 and 50 elements, inclusive.
- Each element of ratingChanges will be between -1000 and 1000, inclusive.
{30, 5, -5, 3, 3, 1}
Returns: 3
The player raises rating two times, afterwards reduces it once and finally raises it three times in a row.
{-1, -5, -9}
Returns: 0
No rating changes are positive.
{12, 0, 15, 73}
Returns: 2
{12, 1, 15, 73}
Returns: 4
{-6, 13, 15, -11, 12, 12, 33, 12, -1}
Returns: 4
Submissions are judged against all 79 archived test cases, of which 5 are shown here. Case numbers match the judge’s.
Language: C++17 · define a public class CompetitionStatistics with a public method int consecutiveGrowth(vector<int> ratingChanges) · 79 test cases · 2 s / 256 MB per case