| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 1 초 | 2048 MB | 69 | 36 | 29 | 48.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.
5 4 3 0 1 1 2 2 3 3 4
yes
6 3 2 1 2 1 4 0 5
no