Sichuan University Programming Contest 2014 Preliminary(team)

H: Rigid Teacher