Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|

Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |

Language: Ikki's Story II - War with TN
Description Do you remember the war of my nation with TN? If you don’t know that story, ask frkstyc to tell you. (And frkstyc says, “Please don’t ask me but refer to problem 2822 TN’s Kingdom IV – Collapse.”) Once upon a time, I defeated the evil nation of TN! How did I do that? Simple! The road network of the country of TN could be viewed as a directed graph, where each city is a vertex and there are edges between cities. And the capital Well, let me see what happened at that time… I wanted to destruct one particular city, All the paths from If all the cities with this property were destroyed and controlled by me, it would be quite certain that TN’s troops could not reach city The evil nation was defeated because Ikki himself solved this problem! If you were Ikki, can you also solve this problem? Input The input contains exactly one test case. The first line of the test case contains two integers
Cities are numbered from 0 to The last line of each test case is an integer t, which is the city that Ikki was going to destroy. Output You should output one line consisting of only one integer Sample Input 2 1 0 1 1 Sample Output 0 Source POJ Monthly--2007.03.04, Ikki |

[Submit] [Go Back] [Status] [Discuss]

All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di

Any problem, Please Contact Administrator