2 shunfurh shunfurh 于 2017.09.16 18:48 提问

Information

It is a war between Country Alpha and Country Beta. Country Alpha gets following information about Country Beta:

Country Beta has n (2 <= n <= 100) cities numbered from 0 to n-1. Each city has a transmitter and a receiver. One city is able to transmit important information by its transmitter to another city. Meanwhile, if there's information transmitted to one city, it is able to receive the information by its receiver. Of course, it is OK that one city doesn't transmit any information to another city and that if no information transmitted to one city, the city receives no information. Thus, a quantity of cities are able to constitute a group. In a group, any city is able to transmit the information to any city in the group directly or indirectly. Of course, one city belongs to only one group.

Now, Country Alpha wants to demolish one city of Country Beta. Thus, Alpha will make the number of cities in the largest group as small as possible.

Input

Ther are multiple test cases (about 200 cases). There is a blank line between each case.

The first line of each case contains two positive integers, n and m (0 <= m <= 9900), in which m indicates the number of the path(es) of the information from one city to another. In each line of following m line(s), there are two positive integers, s, t, indicating that some information is from City s to City t. No same pair of (s,t).

Output

Output the least number of cities in a group, which is the largest group after Country Alpha's attack. By the way, a group must consist of at least two cities, that is, one city is not able to be considered as a group. If there is no group, output 0.

Sample Input

2 2
0 1
1 0
Sample Output

0

1个回答

devmiao
devmiao   Ds   Rxr 2017.09.17 00:28
已采纳
Csdn user default icon
上传中...
上传图片
插入图片
准确详细的回答,更有利于被提问者采纳,从而获得C币。复制、灌水、广告等回答会被删除,是时候展现真正的技术了!
其他相关推荐
jps 报process information unavailable解决办法
jps 报process information unavailable解决办法
process information unavailable
现象描述:  [root@192-168-102-144 opt]#            jps 7297 TaskTracker 7119 DataNode 7706 Jps 15177 Child 15199 Child [root@192-168-102-144 opt]# kill -9 15177 15199 [root@192-168-102-144 opt]#
信息论第二版Elements of Information Theory(2nd Edition).pdf
Elements of Information Theory(2nd Edition).pdf信息论第二版
Keil 出现No Browse information available
选中target1,然后点击右键,选择 option for target 'target1' ,在弹出的对话框中选择output选项卡,看Browse information 选项有没有勾选,如果没有,请勾选,然后把你的工程rebuild 一次。
Incorrect information in file
数据库出现Read-only file system,执行FSCK重启后Mysql的InnoDB引擎无法开启,出现ERROR 1033 (HY000): Incorrect information in file错误,网上搜索多种办法无法解决,最后重启服务器,自动修复了。
Mutual Information
今天挺paper reading的时候,听到了最大化互信息,还不清楚互信息是个什么东东,google了一下,从http://en.wikipedia.org/wiki/Mutual_information摘过来了:    Definition of mutual informationFormally, the mutual information of two d
Hadoop jps出现process information unavailable提示解决办法
AlienTech for better life!~
myeclipse下开发jface出现text包冲突[signer information does not match signer information of other classes in the same package]
<br />今天在写jface程序时出现以下异常:<br />Exception in thread "main" java.lang.SecurityException: class "org.eclipse.jface.text.TextAttribute"'s signer information does not match signer information of other classes in the same package<br /> <br />网上查资料,意思大致为工程里的jar文件
无法阻止System Volume Information文件夹自动生成
 就算我们关闭系统还原,提升我们的账户权限我们也无法阻止System Volume Information文件夹自动生成。其实办法也不是没有,只是技术所限。我们可以找到一直监视System Volume Information改动的那个进程,然后找到其可执行文件,反编译之,改动源代码替换之(改成不能监视),但这需要大量的时间。  
VS/VC++ debugging information cannot be found 不能调试
1. Some possible solutions: You are compiling in release instead of debugYou need to clean/build or rebuildYou don't have your pdb files being generated in the same directory as the exeYou have a m