HDU 3394 Railway 点双连通分量
2016-02-18 23:33
441 查看
判断有多少条边属于多个环或不属于环。
首先一个双连通分量内,
如果边数=点数,那么所有点构成一个环
如果边数>点数,那么肯定有多个环,而且所有边都处于多个环内。
明天贴代码?
Total Submission(s): 1604 Accepted Submission(s): 601
Now we know the plan, and can you tell us how many railways are no need to build and how many railways where clash might happen.
You can assume that there is no loop and no multiple edges.
The last test case is followed by two zeros on a single line, which means the end of the input.
0 1
1 2
2 3
3 0
3 4
4 5
5 6
6 7
7 4
5 7
0 0
首先一个双连通分量内,
如果边数=点数,那么所有点构成一个环
如果边数>点数,那么肯定有多个环,而且所有边都处于多个环内。
明天贴代码?
Railway
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1604 Accepted Submission(s): 601
Problem Description
There are some locations in a park, and some of them are connected by roads. The park manger needs to build some railways along the roads, and he would like to arrange tourist routes to each circuit. If a railway belongs to more than one tourist routes, there might be clash on it, and if a railway belongs to none tourist route, it doesn’t need to build.Now we know the plan, and can you tell us how many railways are no need to build and how many railways where clash might happen.
Input
The Input consists of multiple test cases. The first line of each test case contains two integers, n (0 < n <= 10000), m (0 <= m <= 100000), which are the number of locations and the number of the railways. The next m lines, each line contains two integers, u, v (0 <= u, v < n), which means the manger plans to build a railway on the road between u and v.You can assume that there is no loop and no multiple edges.
The last test case is followed by two zeros on a single line, which means the end of the input.
Output
Output the number of railways that are no need to build, and the number of railways where clash might happen. Please follow the format as the sample.Sample Input
8 100 1
1 2
2 3
3 0
3 4
4 5
5 6
6 7
7 4
5 7
0 0
Sample Output
1 5相关文章推荐
- HDU 4300 Clairewd’s message
- 用find_if查找vector内对象的成员 http://blog.csdn.net/zhongguoren666/article/details/7629610
- STL中的find_if函数 http://blog.csdn.net/hj490134273/article/details/6051080
- sendEmail:出现的错误
- 1090. Highest Price in Supply Chain (25)
- HDU 5293 Tree chain problem - 树形dp&树状数组优化
- zabbix使用sendEmail发送告警邮件
- Organize Your Train part II POJ 3007 (哈希&链式解决冲突)
- C/C++程序中的profile http://blog.csdn.net/cnjet/article/details/2617403
- 11. Container With Most Water
- aidl引用类作为函数的返回值
- INSTALL_FAILED_OLDER_SDK
- grails一对一关联关系
- GDAL应用-gdal_merge.py
- ORA-00245: control file backup failed; target is likely on a local file system
- DataIntegration windows7 64 安装
- mbstring.funcoverload fail
- HDU1839---Delay Constrained Maximum Capacity Path(SPFA+vector+二分)
- Python 18.4 aiohttp
- 斗地主智能(AI)出牌算法