Sichuan University Programming Contest 2009 Preliminary (Single)

D: Fengzlzl's Matrix