Universal Cup Judging System

Universal Cup

Límite de tiempo: 6 s Límite de memoria: 1024 MB Puntuación total: 100 Dificultad: [mostrar] Interactivo
Estadísticas

呢題係互動題。

喺批浪省(Plang Province),有 $n = 300$ 名學生啱啱參加完批浪 OI 2026。當中有一啲人攞到金牌,而其餘嘅人就冇。

批浪省嘅學生有一個奇怪嘅習慣。如果佢哋冇攞到金牌,佢哋會誠實咁話自己冇攞到。但係如果佢哋攞到金牌,佢哋會有 $\frac{1}{2}$ 嘅概率話自己攞到,而有另外 $\frac{1}{2}$ 嘅概率話自己冇攞到。注意每次回答都係隨機嘅,同之前嘅回答冇關。

作為批浪省嘅教練,你想知道每位學生有冇攞到金牌。你可以叫 Una 執行以下操作:

  • 揀一啲互不相同嘅學生,叫 Una 逐個問佢哋有冇攞到金牌。Una 會話俾你知回答「有」嘅人數。

批浪 OI 2025 嘅金牌分數線係 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.