Correct TopCoder SRM 643, Div 2 250