QOJ.ac

QOJ

حد الوقت: 3 s حد الذاكرة: 512 MB مجموع النقاط: 100 تفاعلية

#3675. 交互式数组猜测

الإحصائيات

这是一个交互式问题。

评测系统准备了 $n$ 个非空整数数组 $a_1, a_2, \dots, a_n$。每个数组包含最多 10 个不超过 1000 的正整数。每个数组内的元素互不相同。

你可以进行以下形式的询问:选择若干个下标 $q_1, q_2, \dots, q_m$,其中 $1 \le m \le n$ 且 $1 \le q_i \le n$。这些下标不必互不相同。评测系统会按顺序告诉你数组 $a_{q_1}, a_{q_2}, \dots, a_{q_m}$ 的内容。然而,这些内容会连接在一起,没有任何分隔符。

你的任务是找出所有 $n$ 个数组的内容。

交互格式

首先,评测系统会写入整数 $n$ —— 数组的数量 ($1 \le n \le 1000$)。

你的程序应打印两种类型的请求:

  • ? m q1 q2 ... qm”:对应于对数组 $a_{q_1}, a_{q_2}, \dots, a_{q_m}$ 内容的询问。评测系统会返回这些数组的总长度,随后依次给出数组 $a_{q_1}$ 的内容、数组 $a_{q_2}$ 的内容、……、数组 $a_{q_m}$ 的内容。
  • ! k1 a1,1 ... a1,k1 ... kn an,1 ... an,kn”:表示你的程序已经确定了所有数组的内容,其中 $k_i$ 是数组 $a_i$ 的长度。该请求的格式为:数组 $a_1$ 的长度,紧接着数组 $a_1$ 的内容,数组 $a_2$ 的长度,紧接着数组 $a_2$ 的内容,……,数组 $a_n$ 的长度,紧接着数组 $a_n$ 的内容。

每次请求后请务必刷新输出!

你的程序必须恰好发出一次第二种类型的请求。它必须是最后一次请求,且程序在发出该请求后必须正常终止。

你的程序最多允许发出 20 次第一种类型的请求。

样例

输入 1

3
5 1 1 2 2 1
4 1 2 1 1
2 1 2

输出 1

? 3 1 2 3
? 3 1 3 1
? 1 2
! 1 1 2 1 2 2 2 1

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.