题目
Weibo is known as the Chinese version of Twitter. One user on Weibo may have many followers, and may follow many other users as well. Hence a social network is formed with followers relations. When a user makes a post on Weibo, all his/her followers can view and forward his/her post, which can then be forwarded again by their followers. Now given a social network, you are supposed to calculate the maximum potential amount of forwards for any specific user, assuming that only L L L levels of indirect followers are counted.
Input Specification:
Each input file contains one test case. For each case, the first line contains 2 positive integers: N ( ≤ 1000 ) N(\le1000) N(≤1000), the number of users; and L ( ≤ 6 ) L(\le6) L(≤6), the number of levels of indirect followers that are counted. Hence it is assumed that all the users are numbered from 1 to N N N. Then N N N lines follow, each in the format:
M[i] user_list[i]