#P15511. [CEOI 2015] Calvinball championship, again

    ID: 15400 远端评测题 10000ms 2048MiB 尝试: 0 已通过: 0 难度: (无) 上传者: 标签>2015提交答案Special JudgeCEOI(中欧)

[CEOI 2015] Calvinball championship, again

Description

Recall that a Calvinball championship is being held in Czech Republic this year. A game of Calvinball is played by nn players with distinct names, divided into any number of non-empty teams. Some players dislike each other; disliking is symmetric: if player aa dislikes player bb, then also bb dislikes aa.

The International Calvinball Disorganization decided to make a last-minute change to the team selection procedure: no two people who dislike each other may be on the same team, and subject to that, the number of teams must be as small as possible.

For example, if Calvin, Hobbes, Susie, Tom, Jerry, and Batman play in the game, Batman dislikes everyone else and Tom does not like Jerry and Hobbes, it is possible to play the game with three teams (for example, Batman alone, Tom with Susie, and Calvin with Hobbes and Jerry), but not with two teams (since Batman, Tom, and Jerry dislike each other and must be in different teams), and not with four teams (since a smaller number of teams is possible).

Given the description of which players dislike each other, determine some allowed division of the players into teams (an arbitrary one, if several exist).

Input Format

This is an output-only task. In directory /mo/problems/again, you will find 1010 files called input_000.txt, …, input_009.txt. Each of the files has the following format.

The first line contains two non-negative integers nn and mm, giving the number of players and the number of distinct pairs of players that dislike each other, respectively. The players are numbered from 11 to nn. The ii-th of the mm following lines contains two distinct positive integers aia_i and bib_i (1ai,bin1 \leq a_i, b_i \leq n), showing that the players aia_i and bib_i dislike each other.

Output Format

For the input file input_00kk.txt (with k=0,,9k = 0, \dots, 9), prepare the output file output_00kk.txt with the following format. The first line contains a non-negative integer tt, giving the number of teams to which the players are divided. The ii-th of the following tt lines contains a space-separated list of numbers of players belonging to the ii-th team. The teams as well as the players in each team can be listed in any order.

The output files should be submitted through the contest interface. In case your submission lacks some of the output files, these are copied from the previous submission (if there is any). It is therefore also possible to submit the output files one by one.

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

3
6
4 3
1 2 5

Hint

One of the possible correct outputs is:

3
6
4 3
1 2 5

The example corresponds to the situation described in the task statement, with players numbered as follows:

Player Calvin Hobbes Susie Tom Jerry Batman
Number 11 22 33 44 55 66

Grading

10 points will be awarded for each of the 10 input files for which a correct output is submitted.