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

33783번 - Friends 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 2048 MB69362948.333%

문제

A new social network has been released and as you're very into new technology, you immediately decide to join it. After creating your account, you would look who has joined the network already so you can send some friend requests. It appears this is not a regular social network like Facebook and there's one difference: when you are friends with someone, you're automatically friends with all the people he or she is also friends with. For example, if you're friends with "Jan", and "Jan" is friends with "Piet", then you are also friends with "Piet" and all other people he has as friend.

You are given the details of the network. You know which members have joined the network and which users are friends with each other. Each user has an unique identifier in the network.

More and more people are joining the new established network and you would like to know whether you're friends with everyone. After all, one can never have too much friends on a social network!

입력

The first line consists of the integers $ n ,ドル $ m $ and $ s $ (1ドル \leq n \leq 1000 ,ドル 0ドル \leq m \leq 25000 ,ドル $ 0 \leq s \leq 1000 $): $ n $ is the amount of registered users in the network, $ m $ denotes the number of connections in the network and $ s $ is your user identifier. After that, $ m $ lines follow with on each line two integers: $ a $ and $ b $ which means that users with identifiers $ a $ and $ b $ are friends in the network.

출력

One line with either $ yes $ if you have every other user as a friend or $ no $ if not.

제한

예제 입력 1

5 4 3
0 1
1 2
2 3
3 4

예제 출력 1

yes

예제 입력 2

6 3 2
1 2
1 4
0 5

예제 출력 2

no

힌트

출처

University > Delft University of Technology > Sjaars Kampioenschap Programmeren 2014 F번

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

출처

대학교 대회

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

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