Universal Cup Judging System

Universal Cup

Limite de temps : 6 s Limite de mémoire : 1024 MB Points totaux : 100 Difficulté: [afficher] Interactif
Statistiques

這是一道互動題。

在膨脹省(Plang Province),有 $n = 300$ 名學生剛參加完膨脹 OI 2026。其中,有些人獲得了金牌,而另一些人則沒有。

膨脹省的學生有一個奇怪的習慣。如果他們沒有贏得金牌,他們會誠實地說自己沒有贏得。然而,如果他們贏得了金牌,他們會有 $\frac{1}{2}$ 的機率說自己贏了,而有另外 $\frac{1}{2}$ 的機率說自己沒有贏得。請注意,每次回答都是隨機的,與先前的回答無關。

身為膨脹省的教練,你想知道每位學生是否獲得了金牌。你可以讓 Una 執行以下操作:

  • 選擇一些相異的學生,請 Una 詢問他們每個人是否獲得了金牌。Una 會告訴你回答「是」的人數。

2025 年膨脹 OI 的金牌分數線是 571,因此你應該平均在隆重不超過 568 次詢問內找出答案。

由於膨脹 OI 的限制,你可以假設恰好有 48 名學生獲得了金牌。

problem_14978_4.png

圖 1:教練詢問學生藏了多少分。

互動協議

這是一道互動題。請記得在每次輸出後刷新輸出緩衝區。若要刷新輸出,你可以使用:

  • C/C++ 中的 fflush(stdout) 或 cout.flush();
  • Java 與 Kotlin 中的 System.out.flush();
  • Python 中的 sys.stdout.flush()。

首先,你應該讀取一個整數 $T$($T = 20$),表示測試資料的組數。

對於每組測試資料,你應該讀取一個整數 $n$($n = 300$),表示學生的數量。

若要進行一次詢問,你應該輸出一行格式為「? $k$ $p_1$ $p_2$ ... $p_k$」的字串(滿足 $1 \le p_i \le n$,且對於 $1 \le i < j \le k$ 有 $p_i \ne p_j$)。

接著,讀取一個整數,表示 Una 得到的結果。若你的詢問無效,或你總共進行了超過 $568T$ 次詢問,裁判程式將輸出 $-1$。讀取到 $-1$ 後,你應該立即結束程式,以避免未定義行為。

若你得出了答案,你應該輸出一行格式為「! $s_1s_2\dots s_n$」的字串,其中 $s_i = 1$ 表示第 $i$ 名學生獲得金牌,否則為 0。

接著,讀取一個單字 OK 或 WA,表示你的答案是否正確。若你的程式讀取到 WA,你應該立即結束程式,以避免未定義行為。

請注意,評分程式不是自適應的,也就是說答案不會在你的詢問後改變。最多有 10 個測試點。

範例

輸入

1
2
0
0
1
OK

輸出

? 2 1 2
? 1 1
? 1 2
! 01

說明

請注意,此範例僅供參考,它不滿足 $T = 20$ 與 $n = 300$,且不會出現在最終測試中。

我們提供了一個測試工具來協助參賽者開發並測試他們的解答。你可以從附件中下載此工具。使用 -h 選項執行該工具會說明如何使用它。測試工具僅實作了一些測試情境與真實裁判程式的部分功能。

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.