#P6865. [RC-03] 染色
[RC-03] 染色
Background
Note: The input file is very large, so downloading may be slow (about 3 minutes). Please wait patiently.
This is an output-only problem. Please download the input data from here.
The answers you submit are best named in order as:
- 01.out
- 02.out
- 18.out
Problem Description
Given an undirected graph, find a as small as possible such that the vertices can be divided into sets, and there is no edge between any two vertices in the same set.
Input Format
The first line contains three integers: , meaning there are vertices and edges. As long as your satisfies , you can get full score.
The next lines each contain two integers , describing an edge . .
Output Format
Two lines. The first line contains an integer , your answer. .
The second line contains integers. The -th integer indicates the set number that vertex is assigned to. .
3 3 3
1 2
2 3
3 1
3
1 2 3
Hint
For each test point:
- If your output is invalid, you will get points.
- If , you will get full score.
- Otherwise, you will get (suppose the full score of this test point is ): points.
There are test points in total. All test points satisfy , , and it is guaranteed that there exists a solution with . The scores for each test point are as follows:
| Test Point ID | Score |
|---|---|
Translated by ChatGPT 5