Logo
(追記) (追記ここまで)

24773번 - James’s Birthday Party 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
3 초 1024 MB131655455.102%

문제

James needs some help figuring out whether he can invite all of his friends to his birthday party. Luckily for James, he doesn't have to invite all of his friends by himself, because his friends will forward invitations to each other.

Consider this example: James has three friends: Lucy, Sue, and Mark. James is friends with all three of them, but unfortunately he doesn't have Mark's phone number so he can't invite him directly. However, Sue has Mark's number (and vice versa) so she can invite Mark to James’s party.

The question that you need to answer is that if anyone lost one of the phone numbers for anyone else, would it be impossible to invite everybody to the party? Continuing the above example, if Sue lost Mark's number (the edge denoted by the red arrow above), then it would not be possible to invite everybody to the party. You should assume that if Sue loses Mark's number, then Mark will also lose Sue's number. Please help James figure out if he is at risk at having someone miss his party if any pair of friends loses contact with each other.

입력

The input will contain multiple test cases. Each test case contains on a single line two integer numbers p (1 ≤ p ≤ 100) and c (0 ≤ c ≤ 5000). p represents the number of people James wants to invite to the party, including himself. The next c lines represent the connections among James’s friends represented as two integers a (0 ≤ a < p) and b (0 ≤ b < p), where a is not equal to b. This means that friend number a has friend number b’s phone number and vice versa.

The input will be terminated by a line containing 2 zeros.

출력

For each test case, if a pair could lose each other's numbers and make it so that not everybody can be invited to the party, print "Yes". Otherwise, print "No”.

제한

예제 입력 1

2 1
0 1
4 4
0 1
1 2
2 3
3 0
5 5
0 1
1 2
0 3
3 4
3 1
0 0

예제 출력 1

Yes
No
Yes

힌트

출처

School > Virginia Tech High School Programming Contest > 2014 Virginia Tech High School Programming Contest I번

  • 문제를 만든 사람: Andriy Katkov
(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /