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

24276번 - Circle 서브태스크스페셜 저지다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 1024 MB91282531.250%

문제

In Olympia, there is a circular village with N houses. They are numbered from 1 to N in the clockwise order. For example, if N = 8, the village would look like on the picture (the circle is the border line of the village):

There are М streets inside the circle, each connecting two different houses. There is at most one street between each pair of houses. Also, no two streets intersect, however they can share a common endpoint. As a festival is coming soon, the villagers want to paint their houses. Unfortunately, this isn't so simple as they don't want to have bad streets in their village. They consider a street to be bad when the houses at both of its endpoints are painted in the same color.

Now it's your turn! As the paint is expensive, the villagers need your help to use the least number of colors possible. Write a program circle that finds the minimum number of colors, which are needed, and gives one appropriate way to paint the houses.

입력

The first line of the standard input contains N and M – the number of houses and the number of streets in the village. Each of the next M lines contains two numbers u and v – this means that there is a street between houses with numbers u and v.

출력

On the first line of the standard output, you should print К – the minimum number of colors. On the second line, you should print N numbers – the colors in which you will paint every house. The colors are numbered from 1 to K. If there are multiple solutions, you can print any of them.

제한

  • 2 ≤ N ≤ 5∙105
  • 1 ≤ M ≤ 5∙105

서브태스크

번호배점제한
110

N ≤ 20

230

N ≤ 103

330

N ≤ 105

430

N ≤ 5∙105

예제 입력 1

6 5
1 2
2 3
1 4
3 4
6 5

예제 출력 1

2
1 2 1 2 1 2

힌트

출처

Olympiad > International Autumn Tournament in Informatics > 2019 > Group A (Seniors) 1번

채점 및 기타 정보

  • 예제는 채점하지 않는다.
(追記) (追記ここまで)

출처

대학교 대회

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

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