Mechanism Design For Optimal Contest