E. Experiment!

Codeforces
IDCF10291E
Time15000ms
Memory256MB
Difficulty
English · Original
Formal · Original
_This is an interactive problem._ The PIPAC (Philippine Institute of Pure and Applied Chemistry) is an independent scientific institute which lies between Faura Hall and the School of Management in the Ateneo de Manila University. Despite residing in Ateneo, it is an independent entity from the university, so students are generally not permitted to enter the facilities. PIPAC occasionally hosts guided tours of their labs for those curious of what secrets lie behind its enigmatic white walls. Alice is on one such tour, and when the organizers heard that she was a programmer, they decided to entertain her with a hands-on puzzle. Alice is presented with $1000$ containers of unknown compounds, labeled $1, 2, 3, \\dots, 1000$. Each container holds exactly one type of compound, and no compound appears in more than one different container. She can choose any subset of the containers, take a sample from each, and dissolve all the samples together into one mixture. Then, she can take this mixture to the lab, where a high-tech computer then prints out a list of all the compounds identified in the mixture, *in no particular order*. Alice's task is to identify the compound in each of the $1000$ containers. Using the high-tech computer is expensive and time-consuming, so Alice is challenged to use it *as few times as possible*. In particular, she is assured that her task is possible in *10 uses* or less. She seems to be having some trouble—could you help her out? The judge first outputs a single line containing a single integer $T$, the number of test cases; there will always be exactly $T = 5$ test cases in this problem. Each test case then proceeds as follows. The judge outputs a line containing a single integer $N$, the number of unknown compounds; there will always be exactly $N = 1000$ compounds in this problem. The judge begins by secretly generating $N$ distinct strings, the names of the $N$ compounds. Each name consists of no more than 3 upper or lowercase English letters, and no two different compounds share the same name. The names of the compounds are case-sensitive. You have two types of queries available to you. If you wish to use the machine, output a single line containing the word _MIX_. Then, indicate which containers you would like to test. First, output a positive integer $n$, from $1$ to $N$ inclusive, indicating the number of different containers you will be sampling from. Then, output $n$ distinct whitespace-separated integers, meaning a sample is to be taken from each of the containers with these labels. The judge will then respond with a single line containing $n$ space-separated strings, the compounds identified in the mixture you sent *in no particular order*. If you are ready to give your final answer, output a single line containing the word _ANSWER_. Then, output $N$ whitespace-separated strings, the names of the compounds in the containers from $1$ to $1000$ (in that order). The judge will then respond with a single line containing a $0$ if you were incorrect, or a $1$ if you were correct. If your program receives a $0$, then no further input (for the rest of the test cases) will be given from the judge. In such a case, you should terminate immediately to prevent an _Idleness Limit Exceeded_ verdict. If your program receives a $1$, then simply proceed with the next test case. There will be exactly $T = 5$ test cases. If you identified any of the compounds incorrectly, you get $0$ points. Otherwise, let $Q$ be the maximum number of times you used the _MIX_ query in any of the test cases. Then, scoring is as follows. *Subtask 1* (15 points): $Q <= 1000$ *Subtask 2* (15 points): $Q <= 999$ *Subtask 3* (15 points): $Q <= 750$ *Subtask 4* (10 points): $Q <= 667$ *Subtask 5* (10 points): $Q <= 500$ *Subtask 6* (10 points): $Q <= 250$ *Subtask 7* (9 points): $Q <= 100$ *Subtask 8* (8 points): $Q <= 11$ *Subtask 9* (8 points): $Q <= 10$ For illustration, Alice is allowed a practice round with just one test case and *only $4$* unknown compounds. Let's examine her sample interaction. Alice decides to _MIX_ together $3$ different compounds by taking samples from containers $1$, $2$, and $4$. The judge then responds that Alice's mixture contains _KBr_, _ZnO_, and _NaH_. Alice then decides to _MIX_ together $2$ different compounds by taking samples from containers $3$ and $4$. The judge then responds that Alice's mixture contains _ZnO_ and _CuS_. Finally, Alice decides to _MIX_ together just $1$ compound by taking a sample from container $1$. The judge then responds that Alice's mixture contains _KBr_. Alice is now confident in her logic and ready to _ANSWER_. She reports that, The judge then responds with a $1$ to tell Alice that she is correct! ## Interaction The judge first outputs a single line containing a single integer $T$, the number of test cases; there will always be exactly $T = 5$ test cases in this problem. Each test case then proceeds as follows.The judge outputs a line containing a single integer $N$, the number of unknown compounds; there will always be exactly $N = 1000$ compounds in this problem.The judge begins by secretly generating $N$ distinct strings, the names of the $N$ compounds. Each name consists of no more than 3 upper or lowercase English letters, and no two different compounds share the same name. The names of the compounds are case-sensitive.You have two types of queries available to you.If you wish to use the machine, output a single line containing the word _MIX_. Then, indicate which containers you would like to test. First, output a positive integer $n$, from $1$ to $N$ inclusive, indicating the number of different containers you will be sampling from. Then, output $n$ distinct whitespace-separated integers, meaning a sample is to be taken from each of the containers with these labels.The judge will then respond with a single line containing $n$ space-separated strings, the compounds identified in the mixture you sent *in no particular order*. If you are ready to give your final answer, output a single line containing the word _ANSWER_. Then, output $N$ whitespace-separated strings, the names of the compounds in the containers from $1$ to $1000$ (in that order).The judge will then respond with a single line containing a $0$ if you were incorrect, or a $1$ if you were correct. If your program receives a $0$, then no further input (for the rest of the test cases) will be given from the judge. In such a case, you should terminate immediately to prevent an _Idleness Limit Exceeded_ verdict. If your program receives a $1$, then simply proceed with the next test case. ## Scoring There will be exactly $T = 5$ test cases. If you identified any of the compounds incorrectly, you get $0$ points. Otherwise, let $Q$ be the maximum number of times you used the _MIX_ query in any of the test cases. Then, scoring is as follows.*Subtask 1* (15 points): $Q <= 1000$*Subtask 2* (15 points): $Q <= 999$*Subtask 3* (15 points): $Q <= 750$*Subtask 4* (10 points): $Q <= 667$*Subtask 5* (10 points): $Q <= 500$*Subtask 6* (10 points): $Q <= 250$*Subtask 7* (9 points): $Q <= 100$*Subtask 8* (8 points): $Q <= 11$*Subtask 9* (8 points): $Q <= 10$ [samples] ## Note For illustration, Alice is allowed a practice round with just one test case and *only $4$* unknown compounds. Let's examine her sample interaction. Contestant Judge 1 4MIX31 2 4 KBr ZnO NaHMIX23 4 ZnO CuSMIX11 KBrANSWERKBr NaH CuS ZnO 1 First, the judge informs her that there is only $1$ test case in the practice round with $4$ unknown compounds.Alice decides to _MIX_ together $3$ different compounds by taking samples from containers $1$, $2$, and $4$. The judge then responds that Alice's mixture contains _KBr_, _ZnO_, and _NaH_.Alice then decides to _MIX_ together $2$ different compounds by taking samples from containers $3$ and $4$.The judge then responds that Alice's mixture contains _ZnO_ and _CuS_.Finally, Alice decides to _MIX_ together just $1$ compound by taking a sample from container $1$.The judge then responds that Alice's mixture contains _KBr_.Alice is now confident in her logic and ready to _ANSWER_. She reports that, Container $1$ contains _KBr_. Container $2$ contains _NaH_. Container $3$ contains _CuS_. Container $4$ contains _ZnO_. The judge then responds with a $1$ to tell Alice that she is correct!
**Definitions** Let $ N = 1000 $ be the number of containers, each containing a unique compound. Let $ C = \{c_1, c_2, \dots, c_N\} $ be the set of unknown compound names, with $ c_i \in \Sigma^{*} $, $ |\Sigma| = 52 $, $ |c_i| \leq 3 $, all distinct and case-sensitive. Let $ Q $ be the number of MIX queries used. **Constraints** 1. $ T = 5 $ test cases. 2. For each test case: - $ N = 1000 $. - Each compound name is unique and consists of 1–3 ASCII letters (a–z, A–Z). 3. Alice may issue MIX queries: - Each MIX query specifies a subset $ S \subseteq \{1, 2, \dots, N\} $, $ |S| \geq 1 $. - Response: the set $ \{ c_i \mid i \in S \} $, returned as an unordered list. 4. Alice must output ANSWER with the full mapping $ i \mapsto c_i $ for $ i = 1 $ to $ N $. 5. Goal: $ Q \leq 10 $ across all test cases. **Objective** Recover the bijection $ f: \{1, 2, \dots, N\} \to C $ using at most 10 MIX queries per test case.
API Response (JSON)
{
  "problem": {
    "name": "E. Experiment!",
    "description": {
      "content": "_This is an interactive problem._ The PIPAC (Philippine Institute of Pure and Applied Chemistry) is an independent scientific institute which lies between Faura Hall and the School of Management in t",
      "description_type": "Markdown"
    },
    "platform": "Codeforces",
    "limit": {
      "time_limit": 15000,
      "memory_limit": 262144
    },
    "difficulty": "None",
    "is_remote": true,
    "is_sync": true,
    "sync_url": null,
    "sign": "CF10291E"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "_This is an interactive problem._\n\nThe PIPAC (Philippine Institute of Pure and Applied Chemistry) is an independent scientific institute which lies between Faura Hall and the School of Management in t...",
      "is_translate": false,
      "language": "English"
    },
    {
      "statement_type": "Markdown",
      "content": "**Definitions**  \nLet $ N = 1000 $ be the number of containers, each containing a unique compound.  \nLet $ C = \\{c_1, c_2, \\dots, c_N\\} $ be the set of unknown compound names, with $ c_i \\in \\Sigma^{*...",
      "is_translate": false,
      "language": "Formal"
    }
  ]
}
Full JSON Raw Segments