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

11417번 - Race 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 256 MB8000.000%

문제

Bob is member of the organizing committee of the annual motorcycling race. His job is to label the contest map. All the roads of the map are bidirectional and connect two places. Each place on the map must be labeled regular or service, such that no place has more than max neighbors of its own label. Let's define degree the maximum number of roads reaching a place. Then max = degree / 2. Your job is to help Bob.

입력

The input file starts with the number n (0<n<1001) of places on the map, on a separate line. Each place is identified by a natural number from 0 to n - 1. Then follows n lines containing the description of places, each on a separate line. Line i, i = 0,.., n-1, describing place i, has the following form:

number_of_neighbors: neighbor1 neighbor2 ... neighborm

출력

The ouput file must contain the labeled map. The format is the same except that each line describing a place starts with the label of the place: 0 for regular places and 1 for service places.

label number_of_neighbors: neighbor1 neighbor2 ... neighborm

제한

예제 입력 1

3
2: 1 2
2: 0 2
2: 0 1

예제 출력 1

3
1 2: 1 2
0 2: 0 2
0 2: 0 1

힌트

The sample describes a map with 3 places that are all connected. The first line of the input contains the number of places. The following lines contain the description of places. For example the line 2: 1 2 stands for the place identified by 0, that has 2 neighbors identified as 1 and 2. In the output file the line 1 2: 1 2 stands for the place 0 that has label 1.

출처

ICPC > Regionals > Europe > Southeastern European Regional Contest > SEERC 2015 G번

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

출처

대학교 대회

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

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