1097 - HW4.5-Graph Scoreboard

Time

2016/12/08 18:00:00 2016/12/16 18:00:00

Clarification

# Problem Asker Description Reply Replier Reply Time For all team

# Problem Pass Rate (passed user / total user)
11249 2-Colorable

11249 - 2-Colorable   

Description

In a coloring problem, no vertex can be colored using the same color as its neighbors.

Now, you are asked to check a given graph can be drawn by only 2 colors or not.

Hint: You can use graph traversal methods to draw colors

Input

Each graph starts with two numbers (0 ≤ m, n ≤ 1000), m is the numbers of all vertex in the graph, n is the numbers of all edge in the graph. The following n tuples x and y (0 ≤ x, y ≤ 1000) specifying that there will be an edge between x and y. Notice that each graph is a simple graph and connected.

Output

For each graph, output a line with “Yes” if it can be drawn by only 2 colors, else output “No”.

Sample Input  Download

Sample Output  Download

Tags




Discuss