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

24782번 - Coloring Graphs 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
6 초 (추가 시간 없음) 1024 MB65262141.176%

문제

To address the impending STEM shortage early on, your local elementary school decided to teach graph theory to its kindergarten students! To tap into their age-specific skills, the students are asked to color the vertices of a graph with colors of their own choosing. There is one constraint, however: they cannot use the same color for two vertices if those vertices are connected by an edge. Furthermore, they are asked to use as few different colors as possible. The illustration shows a few examples of student work.

There is one problem, as you can imagine: there is no money to train teachers to grade these students' submissions! Thus, your task is to write a program that computes the sample solutions for the graphs given on each work sheet!

입력

The input consists of a description of a single graph. The first line contains a number $N$ (2ドル \le N \le 11$), the number of vertices in the graph. Vertices are numbered 0ドル \ldots N-1$. The following $N$ lines contain one or more numbers each. The $i^{th}$ line contains a list of vertex numbers ${ v_j },ドル denoting edges from $v_i$ to each $v_j$ in the list. You may assume that the graph is connected (there is a path between any two pairs of vertices).

출력

Output the minimum number of colors required to color all vertices of the graph such that no vertices that share an edge are colored using the same color!

The sample input corresponds to the graphs shown on the illustration.

제한

예제 입력 1

4
1 2
0 2 3
0 1
1

예제 출력 1

3

예제 입력 2

5
2 3 4
2 3 4
0 1
0 1
0 1

예제 출력 2

2

예제 입력 3

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

예제 출력 3

2

예제 입력 4

4
1 2 3
0 2 3
0 1 3
0 1 2

예제 출력 4

4

예제 입력 5

5
1 2
0 2 3
0 1 4
1 4
2 3

예제 출력 5

3

힌트

출처

School > Virginia Tech High School Programming Contest > 2015 Virginia Tech High School Programming Contest H번

  • 문제를 만든 사람: Godmar Back
(追記) (追記ここまで)

출처

대학교 대회

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

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