#P15511. [CEOI 2015] Calvinball championship, again
[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 players with distinct names, divided into any number of non-empty teams. Some players dislike each other; disliking is symmetric: if player dislikes player , then also dislikes .
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 files called input_000.txt, …, input_009.txt. Each of the files has the following format.
The first line contains two non-negative integers and , giving the number of players and the number of distinct pairs of players that dislike each other, respectively. The players are numbered from to . The -th of the following lines contains two distinct positive integers and (), showing that the players and dislike each other.
Output Format
For the input file input_00.txt (with ), prepare the output file output_00.txt with the following format. The first line contains a non-negative integer , giving the number of teams to which the players are divided. The -th of the following lines contains a space-separated list of numbers of players belonging to the -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 |
Grading
10 points will be awarded for each of the 10 input files for which a correct output is submitted.
京公网安备 11011102002149号