Pro.ID22786 TitleField Plan Title链接http://10.20.2.8/oj/exercise/problem?problem_id=22786 AC16 Submit28 Ratio57.14% 时间&空间限制描述WorldSoccer Championship is coming soon and coach Yogi wants to prepare his team aswell as possible. So he made up a strategy field plan for every player of theteam. One plan describes a number of possible locations for the player on the field.Moreover, if Yogi wants the player to be able to move from one location A toanother location B then the plan specifies the ordered pair (A,B). He is surethat his team will win if the players run over the field from one location toanother using only moves of the plan. Yogi tells every player to follow his plan and to startfrom a location that reaches every other location on the plan (by possiblymultiple moves). However, it is quite dificult for some soccer players, simple mindedas they are, to find a suitable starting location. Can you help every player tofigure out the set of possible start locations? 输入Thefirst line gives the number of field plans. The input contains at most eleven field plans (what else?). Every plan starts with a line of two integers N and M, with 1 ≤ N ≤ 100000 and 1 ≤ M ≤ 100000, giving the number of locations and the number of moves. In the following M lines a plan specifies moves (A, B) by two white space separated integers 0 ≤ A, B < N. The plans are separated by a blank line. 输出Description WorldSoccer Championship is coming soon and coach Yogi wants to prepare his team aswell as possible. So he made up a strategy field plan for every player of theteam. One plan describes a number of possible locations for the player on the field.Moreover, if Yogi wants the player to be able to move from one location A toanother location B then the plan specifies the ordered pair (A,B). He is surethat his team will win if the players run over the field from one location toanother using only moves of the plan. Yogi tells every player to follow his plan and to startfrom a location that reaches every other location on the plan (by possiblymultiple moves). However, it is quite dificult for some soccer players, simple mindedas they are, to find a suitable starting location. Can you help every player tofigure out the set of possible start locations? Input Thefirst line gives the number of field plans. The input contains at most eleven field plans (what else?). Every plan starts with a line of two integers N and M, with 1 ≤ N ≤ 100000 and 1 ≤ M ≤ 100000, giving the number of locations and the number of moves. In the following M lines a plan specifies moves (A, B) by two white space separated integers 0 ≤ A, B < N. The plans are separated by a blank line. Output Forevery plan print out all possible starting locations, sorted increasingly and one per line. If there are no possible locations to start, print "Confused". Print a blank line after each plan output. Sample Input 2 Sample Output 0 Source 样例输入2 样例输出0 作者 |