您好,欢迎来到暴趣科技网。
搜索
您的当前位置:首页1320. Graph Decomposition

1320. Graph Decomposition

来源:暴趣科技网

1320. Graph Decomposition

Time limit: 0.5 second Memory limit: MB
There is a simple graph with an even number of edges. You are to define if it is possible to present it by the set of pairs of adjacent edges (having a common vertex).

Input

contains a sequence of the numbers pairs. Each pair denotes vertices identifiers of one edge. All the identifiers are integers from 1 to 1000. You may assume that there are no loops and multiple edges in the graph defined by the input data.

Output

“1” (without quotation marks), if the decomposition is possible and “0” otherwise.

Samples

inputoutput
1 2
2 3
3 1
1 10
1
1 2
2 3
3 1
4 10
0
Problem Author: Idea: Alexander Petrov, prepared by Alexander Petrov, Leonid Volkov Problem Source: VIII Collegiate Students Urals Programming Contest. Yekaterinburg, March 11-16, 2004
***************************************************************************************
并查集&&计算相应根节点的度数和。
***************************************************************************************

 

转载于:https://www.cnblogs.com/sdau--codeants/p/3259601.html

因篇幅问题不能全部显示,请点此查看更多更全内容

Copyright © 2019- baoquwan.com 版权所有 湘ICP备2024080961号-7

违法及侵权请联系:TEL:199 18 7713 E-MAIL:2724546146@qq.com

本站由北京市万商天勤律师事务所王兴未律师提供法律服务