bzoj#P1763. [Baltic2009] Subway

[Baltic2009] Subway

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