Topcoder 5849 - MatchMaking problem solved