#P15509. [CEOI 2014] Carnival
[CEOI 2014] Carnival
Description
Each of Peter’s friends (numbered from to ) bought exactly one carnival costume in order to wear it at this year’s carnival parties. There are different kinds of costumes, numbered from to . Some of Peter’s friends, however, might have bought the same kind of costume. Peter would like to know which of his friends bought the same costume. For this purpose, he organizes some parties, to each of which he invites some of his friends. Peter knows that on the morning after each party he will not be able to recall which costumes he will have seen the night before, but only how many different kinds of costumes he will have seen at the party. Peter wonders if he can nevertheless choose the guests of each party such that he will know in the end, which of his friends had the same kind of costume. Help Peter!
Interaction
Your program must interact with the grader via standard input and output.
First, your program must read a line that contains the number of friends.
Then, your program should interact with the grader as follows: To specify a party, it outputs a single line; this line contains the number of people to invite (), followed by a list of the numbers of people to invite to this party (see example). Don’t forget to flush the output (for example, using fflush(stdout); or cout << endl;)! Afterwards, your program must read the answer: one line with the number of different kinds of costumes that were worn by his friends at this party.
As soon as your program has determined which friend bought which costume, it should output this result in one line. This line starts with the number , followed by space separated integers ( for all ): specifies the kind of costume that friend number has bought. The numbering of the kinds of costumes does not matter; it is only necessary that identical costumes have identical numbers and that different costumes have different numbers and that the costumes all have numbers between and .
Immediately afterwards, your program must terminate (with return 0;).
Hint
Sample 1
The first example is about friends with costume numbers . In the example interaction, the lines beginning with grader describe the input read by a solution program. The lines beginning with program describe the output of the solution program. The parties specified in the first example do not suffice to safely determine the costume assignment, of course – the solution program was just lucky to guess correctly.
Sample 2
The second example is about friends with costume numbers , and it is sufficient to specify these two parties to determine the costume assignment.
Constraints and grading
We always have .
If your program needs to specify parties to determine the costume assignment for a test case, it will score
- points if ,
- of all points if and
- all points if .
京公网安备 11011102002149号