問題一覧 > 通常問題

No.3347 Guess The Array

レベル : / AI推定難易度 : 1900 / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 512 MB / リアクティブ問題 (詳しくはこちら)
タグ : (AC するまで非表示) / 解いたユーザー数 29
作問者 : ponjuice / テスター : tassei903 Nzt3 jupiter_68 noya2 りすりす/TwoSquirrels
お気に入りにしたユーザー ProblemId : 12796 / 自分の提出
問題文最終更新日: 2025-11-13 16:24:28
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence. Back to the original
yukicoder contest 作問ハッカソンコンテスト 003 Day1 (順位表) の他の問題:

Problem Statement

This is an interactive problem.

You are first given an integer $N$. The judge holds a hidden sequence $A$ of length $N$.

You may repeatedly ask the judge the following question.

  • Create one sequence $B$ of any length and send $B$ to the judge. Here, $1\le |B| \le N$ must hold, and every element of $B$ must be an integer between $1$ and $N$, inclusive.
  • The judge determines whether $B$ is a (not necessarily contiguous) subsequence of $A$ and tells you the result.

Identify the sequence $A$ using at most $5000$ questions.

Note that the sequence $A$ is fixed before the interaction begins and does not change depending on your questions.

Constraints

  • $N$ is an integer
  • $1 \leq N \leq 500$
  • Each element of the sequence $A$ is an integer between $1$ and $N$, inclusive

Input and Output

This is an interactive problem (a problem in which your program and the judge system interact through input and output).

First, the length $N$ of the sequence is given.

$N$

After that, your program may ask questions in the following format, where $k=|B|$.

$?$ $k$ $B_1$ $B_2$ $\cdots$ $B_k$

After you send a question, the judge's response is given in the following format.

$S$

Here, $S$ is Yes or No, where

  • $S$ being Yes means that $B$ is a (not necessarily contiguous) subsequence of $A$.
  • $S$ being No means that $B$ is not a (not necessarily contiguous) subsequence of $A$.

When you output the answer, print it in the following format. After printing it, terminate your program.

$!$ $A_1$ $A_2$ $\cdots$ $A_N$

Notes

  • Each time you output something, end it with a newline and flush standard output. Otherwise, the judge result may be TLE or WA.
  • If a question is in an invalid format, or if you exceed the number of questions, the judge's response is undefined.
  • Note that extra newlines are regarded as output in an invalid format.
  • The output of your answer is not counted toward the number of questions.

Sample

Program's outputJudge's outputExplanation
5First, $N$ is given. The judge holds the hidden sequence $A=(1,2,3,4,5)$.
? 3 1 2 4The program sends $B = (1, 2, 4)$ to the judge as a question.
Yes$B$ is contained in $A$ as a subsequence, so Yes is returned.
? 3 3 2 1The program sends $B = (3, 2, 1)$ to the judge as a question.
No$B$ is not contained in $A$ as a subsequence, so No is returned.
! 1 2 3 4 5The program outputs $(1,2,3,4,5)$ as the answer. This matches $A$, so it is judged correct.

提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。