bzoj#P1761. [Baltic2009] Beetle

[Baltic2009] Beetle

本题已重题,题目链接:link