F.A.Q
Hand In Hand
Online Acmers
Problem Archive
Realtime Judge Status
Authors Ranklist
 
     C/C++/Java Exams     
ACM Steps
Go to Job
Contest LiveCast
ICPC@China
Best Coder beta
VIP | STD Contests
    DIY | Web-DIY beta
Author ID 
Password 
 Register new ID

The Partition of A Graph

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 320    Accepted Submission(s): 119


Problem Description
Simple enough, you’ll be given a simple undirected graph with n vertexes and m edges, try to divide this graph fits the following requirements: All edges are divided into several groups; only two edges exist in every group, and this two edges have common vertex.
Your task is to figure out if such a partition exists.
 

Input
There are multiple test cases, for each test case:
The first line contains two integers n (0<n<=1000) and m represent the number of vertexes and edges.
The following m lines, each line contains two integers represent two endpoints of an edge.
The vertexes are numbered from 1 to n.
The input terminated when n=m=0.
 

Output
For each test case, output one line, if such a partition exists, print “Yes”, otherwise, print “No”.
 

Sample Input
3 3 1 2 1 3 2 3 3 2 1 2 1 3 0 0
 

Sample Output
No Yes
 

Source
 

Statistic | Submit | Discuss | Note
Hangzhou Dianzi University Online Judge 3.0
Copyright © 2005-2024 HDU ACM Team. All Rights Reserved.
Designer & Developer : Wang Rongtao LinLe GaoJie GanLu
Total 0.000000(s) query 1, Server time : 2024-07-03 18:16:31, Gzip enabled