Topcoder: CatsOnTheLineDiv1

Solution to Topcoder SRM 631 Div. 1 500pt problem