TypoCoderDiv2
SRM 602 · 2013-11-22 · by snuke
Problem Statement
Whenever a new contestant joins TypoCoder, their rating is 500. Cat Lower joined TypoCoder and then competed in some contests. You are given a
Return the number of times Cat Lower changed his color (i.e., changed from being a ciel coder to being a brown coder or back).
Constraints
- rating will contain between 1 and 50 elements, inclusive.
- Each element of rating will be between 0 and 4000, inclusive.
Statement by TopCoder, Inc. — view the original on the archive.
{1000,1200,1199}
Returns: 2
After the first contest Cat Lower was still a ciel coder. After the second contest his new rating was 1200 which made him a brown coder. (This was the first color change.) After the third contest his new rating was 1199 which made him a ciel coder again. (This was the second color change.)
{1500,2200,900,3000}
Returns: 3
The color changed after the first, the third and the fourth competition.
{600,700,800,900,1000,1100,1199}
Returns: 0
Cat Lower wasn't a brown coder at any time in this case.
{0,4000,0,4000,4000,0,0}
Returns: 4
{575,1090,3271,2496,859,2708,3774,2796,1616,2552,3783,2435,1111,526,562}
Returns: 4
Submissions are judged against all 75 archived test cases, of which 5 are shown here. Case numbers match the judge’s.
Language: C++17 · define a public class TypoCoderDiv2 with a public method int count(vector<int> rating) · 75 test cases · 2 s / 256 MB per case