SRM 441. div2-1000. Backtracking solution. Overshoots time limit.