#P1854D. Michael and Hotel

    ID: 8626 Type: RemoteJudge 2000ms 256MiB Tried: 0 Accepted: 0 Difficulty: 10 Uploaded By: Tags>binary searchinteractivetrees*3000

Michael and Hotel

No submission language available for this problem.

Description

Michael and Brian are stuck in a hotel with nn rooms, numbered from 11 to nn, and need to find each other. But this hotel's doors are all locked and the only way of getting around is by using the teleporters in each room. Room ii has a teleporter that will take you to room aia_i (it might be that ai=ia_i = i). But they don't know the values of a1,a2,,ana_1,a_2, \dots, a_n.

Instead, they can call up the front desk to ask queries. In one query, they give a room uu, a positive integer kk, and a set of rooms SS. The hotel concierge answers whether a person starting in room uu, and using the teleporters kk times, ends up in a room in SS.

Brian is in room 11. Michael wants to know the set AA of rooms so that if he starts in one of those rooms they can use the teleporters to meet up. He can ask at most 20002000 queries.

The values a1,a2,,ana_1, a_2, \dots, a_n are fixed before the start of the interaction and do not depend on your queries. In other words, the interactor is not adaptive.

The input contains a single integer nn (2n5002 \leq n \leq 500).

Interaction

To ask a query, print a line in the format "? u k |S| S_1 S_2 ... S_|S|" with 1u,S1,,SSn1 \leq u, S_1, \ldots, S_{|S|} \leq n, all the SiS_i distinct, and 1k1091 \leq k \leq 10^9.

As a response to the query you will get "1" if the answer is yes, and "0" if the answer is no.

To output an answer, you should print "! |A| A_1 A_2 ... A_|A|" with 1A1,,AAn1 \leq A_1, \ldots, A_{|A|} \leq n all distinct. Printing the answer doesn't count as a query.

See the interaction example for more clarity.

If you ask too many queries or you ask a malformed query, you will get Wrong answer.

After printing a query do not forget to output the end of line and flush the output. Otherwise, you will get Idleness limit exceeded. To do this, use:

  • fflush(stdout) or cout.flush() in C++;
  • System.out.flush() in Java;
  • flush(output) in Pascal;
  • stdout.flush() in Python;
  • see the documentation for other languages.

Hack format

For the hacks use the following format.

The first line should contain nn — the number of rooms.

The second line should contains nn integers a1,a2,,ana_1, a_2, \dots, a_n — the teleporter in room ii leads to room aia_i.

Input

The input contains a single integer nn (2n5002 \leq n \leq 500).

Sample Input 1

5

0

1

Sample Output 1

? 3 5 2 2 3

? 2 5 2 2 3

! 3 1 3 4

Note

In the sample test, there are n=5n=5 rooms and the (hidden) array describing the behavior of the teleporters is [1,2,1,3,2][1, 2, 1, 3, 2].

  • The first query asks whether starting from room number a=3a=3, and using the teleporters 55 times, one ends up in one of the two rooms S={2,3}S=\{2, 3\}. This action results in ending up in the room 11, so the answer is 00.
  • The second query asks whether starting from room number a=2a=2, and using the teleporters 55 times, one ends up in one of the two rooms S={2,3}S=\{2, 3\}. This action results in ending up in the room 22, so the answer is 11.