QOJ.ac

QOJ

Límite de tiempo: 2 s Límite de memoria: 256 MB Puntuación total: 100 Hackeable ✓

#18949. Guess the 01 Sequence

Estadísticas

This is an interactive problem.

Given a positive integer $n$, the grader generates an unknown 01 sequence $a_1,a_2,\dots,a_n$ of length $n$. You may ask the grader at most $17$ queries to determine the number of 1s in this 01 sequence, i.e., $\sum\limits_{i=1}^n a_i$. It is guaranteed that there is at least one 1.

For each query, you may choose several positions $i_1,i_2,\dots,i_k$. Let $I=\{i_1,i_2,\dots,i_k\}$. The grader will return the value of $(\sum\limits_{j\in I} a_j) \cdot (\sum\limits_{j\notin I} a_j)$.

Input

The first line contains a positive integer $n$ $(1\le n\le 10^5)$, the length of the 01 sequence.

Interaction

For a query, output a line in the following format (without quotes):

? k i_1 i_2 ... i_k $(1\le k\le n,1\le i_1< i_2< \dots< i_k\le n)$.

To output the answer, output a line in the following format (without quotes):

! s, where $s=\sum\limits_{i=1}^n a_i$.

Outputting the answer does not count toward the number of queries.

The interactor is non-adaptive, meaning the answer is fixed before any queries are made and does not depend on the queries you make.

After outputting each query, do not forget to output a newline and flush the output buffer.

You can use the following statements to flush the buffer:

  • For C/C++: fflush(stdout)
  • For C++: std::cout << std::flush
  • For Java: System.out.flush()
  • For Python: sys.stdout.flush()

Examples

Input 1

3

2

Output 1

? 2 1 3

! 3

Input 2

3

0

0

Output 2

? 1 1

? 1 2

! 1

Note

The hidden sequence in the first sample is $[1,1,1]$, and the hidden sequence in the second sample is $[0,1,0]$.

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.