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

5938번 - Daisy Chains in the Field 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 128 MB114649040641.176%

문제

Farmer John let his N (1 <= N <= 250) cows conveniently numbered 1..N play in the field. The cows decided to connect with each other using cow-ropes, creating M (1 <= M <= N*(N-1)/2) pairwise connections. Of course, no two cows had more than one rope directly connecting them. The input shows pairs of cows c1 and c2 that are connected (1 <= c1 <= N; 1 <= c2 <= N; c1 != c2).

FJ instructed the cows to be part of a chain which contained cow #1. Help FJ find any misbehaving cows by determining, in ascending order, the numbers of the cows not connected by one or more ropes to cow 1 (cow 1 is always connected to herself, of course). If there are no misbehaving cows, output 0.

To show how this works, consider six cows with four connections:

 1---2 4---5
 \ |
 \ | 6
 \|
 3

Visually, we can see that cows 4, 5, and 6 are not connected to cow 1.

입력

  • Line 1: Two space-separated integers: N and M
  • Lines 2..M+1: Line i+1 shows two cows connected by rope i with two space-separated integers: c1 and c2

출력

  • Lines 1..???: Each line contains a single integer

제한

예제 입력 1

6 4
1 3
2 3
1 2
4 5

예제 출력 1

4
5
6

힌트

출처

Olympiad > USA Computing Olympiad > 2010-2011 Season > USACO November 2010 Contest > Bronze 1번

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

출처

대학교 대회

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

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