{"problem":{"name":"B. Hongcow's Game","description":{"content":"**This is an interactive problem. In the interaction section below you will see the information about flushing the output.** In this problem, you will be playing a game with Hongcow. How lucky of you","description_type":"Markdown"},"platform":"Codeforces","limit":{"time_limit":3000,"memory_limit":262144},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"CF744B"},"statements":[{"statement_type":"Markdown","content":"**This is an interactive problem. In the interaction section below you will see the information about flushing the output.**\n\nIn this problem, you will be playing a game with Hongcow. How lucky of you!\n\nHongcow has a hidden _n_ by _n_ matrix _M_. Let _M__i_, _j_ denote the entry _i_\\-th row and _j_\\-th column of the matrix. The rows and columns are labeled from 1 to _n_.\n\nThe matrix entries are between 0 and 109. In addition, _M__i_, _i_ = 0 for all valid _i_. Your task is to find the minimum value along each row, excluding diagonal elements. Formally, for each _i_, you must find .\n\nTo do this, you can ask Hongcow some questions.\n\nA question consists of giving Hongcow a subset of distinct indices {_w_1, _w_2, ..., _w__k_}, with 1 ≤ _k_ ≤ _n_. Hongcow will respond with _n_ integers. The _i_\\-th integer will contain the minimum value of _min_1 ≤ _j_ ≤ _k__M__i_, _w__j_.\n\nYou may only ask Hongcow at most 20 questions — he thinks you only need that many questions answered.\n\nWhen you are ready to answer, print out a single integer  - 1 on its own line, then _n_ integers on the next line. The _i_\\-th integer should be the minimum value in the _i_\\-th row of the matrix, excluding the _i_\\-th element. Do not forget to flush the final answer as well. Printing the answer does not count as asking a question.\n\nYou will get _Wrong Answer_ verdict if\n\n*   Your question or answers are not in the format described in this statement.\n*   You ask strictly more than 20 questions.\n*   Your question contains duplicate indices.\n*   The value of _k_ in your question does not lie in the range from 1 to _n_, inclusive.\n*   Your final answer is not correct.\n\nYou will get _Idleness Limit Exceeded_ if you don't print anything or if you forget to flush the output, including for the final answer (more info about flushing output below).\n\n## Input\n\nThe first line of input will contain a single integer _n_ (2 ≤ _n_ ≤ 1, 000).\n\n## Output\n\nTo print the final answer, print out the string _\\-1_ on its own line. Then, the next line should contain _n_ integers. The _i_\\-th integer should be the minimum value of the _i_\\-th row of the matrix, excluding elements on the diagonal. **Do not forget to flush your answer!**\n\n[samples]\n\n## Interaction\n\nTo ask a question, print out a single integer _k_ on its own line, denoting the size of your subset. Then, the next line should contain _k_ integers _w_1, _w_2, ... _w__k_. Note, you must flush your output to get a response.\n\nHongcow will respond by printing out a line with _n_ integers. The _i_\\-th integer in this line represents the minimum value of _M__i_, _w__j_ where _j_ is between 1 and _k_.\n\nYou may only ask a question at most 20 times, otherwise, you will get _Wrong Answer_.\n\nTo flush you can use (just after printing an integer and end-of-line):\n\n*   _fflush(stdout)_ in C++;\n*   _System.out.flush()_ in Java;\n*   _stdout.flush()_ in Python;\n*   _flush(output)_ in Pascal;\n*   See the documentation for other languages.\n\n**Hacking** To hack someone, use the following format\n\nn\nM_{1,1} M_{1,2} ... M_{1,n}\nM_{2,1} M_{2,2} ... M_{2,n}\n...\nM_{n,1} M_{n,2} ... M_{n,n}\n\nOf course, contestant programs will not be able to see this input.\n\n## Note\n\nIn the first sample, Hongcow has the hidden matrix\n\n\\[\n \\[0, 3, 2\\],\n \\[5, 0, 7\\],\n \\[4, 8 ,0\\],\n\\]\n\nHere is a more readable version demonstrating the interaction. The column on the left represents Hongcow, while the column on the right represents the contestant.\n\n3\n              3\n              1 2 3\n0 0 0\n              1\n              3\n2 7 0\n              2\n              1 2\n0 0 4\n              1\n              2\n3 0 8\n              1\n              1\n0 5 4\n              -1\n              2 5 4\n\nFor the second sample, it is possible for off-diagonal elements of the matrix to be zero.","is_translate":false,"language":"English"},{"statement_type":"Markdown","content":"*这是一个交互式问题。在下面的交互部分，你将看到有关刷新输出的信息。*\n\n在这个问题中，你将和 Hongcow 玩一个游戏。你真幸运！\n\nHongcow 有一个隐藏的 #cf_span[n] × #cf_span[n] 矩阵 #cf_span[M]。令 #cf_span[Mi, j] 表示矩阵的第 #cf_span[i] 行、第 #cf_span[j] 列的元素。行和列的编号从 #cf_span[1] 到 #cf_span[n]。\n\n矩阵元素的值在 #cf_span[0] 到 #cf_span[109] 之间。此外，对于所有合法的 #cf_span[i]，都有 #cf_span[Mi, i = 0]。你的任务是找出每一行中除对角线元素外的最小值。形式上，对于每个 #cf_span[i]，你必须找到 。\n\n为了完成这个任务，你可以向 Hongcow 提问。\n\n一个提问由给出一个互不相同的下标集合 #cf_span[{w1, w2, ..., wk}] 组成，其中 #cf_span[1 ≤ k ≤ n]。Hongcow 会返回 #cf_span[n] 个整数。第 #cf_span[i] 个整数表示 #cf_span[min1 ≤ j ≤ kMi, wj] 的值。\n\n你最多只能向 Hongcow 提问 #cf_span[20] 次——他认为你只需要这么多问题的答案。\n\n当你准备好给出答案时，请单独输出一个整数 #cf_span[ - 1]，然后在下一行输出 #cf_span[n] 个整数。第 #cf_span[i] 个整数应为矩阵第 #cf_span[i] 行中除去第 #cf_span[i] 个元素的最小值。同样不要忘记刷新最终答案！输出答案不计入提问次数。\n\n如果你出现以下情况，将获得 _Wrong Answer_：\n\n输入的第一行将包含一个整数 #cf_span[n]（#cf_span[2 ≤ n ≤ 1, 000]）。\n\n要输出最终答案，请单独输出字符串 _-1_，然后下一行输出 #cf_span[n] 个整数。第 #cf_span[i] 个整数应为矩阵第 #cf_span[i] 行中除去对角线元素的最小值。*不要忘记刷新你的答案！*\n\n要提问，请单独输出一个整数 #cf_span[k]，表示你所选子集的大小。然后下一行输出 #cf_span[k] 个整数 #cf_span[w1, w2, ... wk]。注意，你必须刷新输出才能获得响应。\n\nHongcow 会回复一行包含 #cf_span[n] 个整数。该行中第 #cf_span[i] 个整数表示 #cf_span[Mi, wj] 在 #cf_span[j] 介于 #cf_span[1] 和 #cf_span[k] 时的最小值。\n\n你最多只能提问 #cf_span[20] 次，否则你将获得 _Wrong Answer_。\n\n要刷新输出，可以在输出一个整数并换行后使用：\n\n*Hacking* 要 Hack 他人，请使用以下格式：\n\n当然，参赛程序无法看到此输入。\n\n在第一个样例中，Hongcow 的隐藏矩阵为 \n\n下面是一个更易读的交互演示。左侧列代表 Hongcow，右侧列代表参赛者。 \n\n对于第二个样例，矩阵的非对角线元素可能为零。\n\n## Input\n\n输入的第一行将包含一个整数 #cf_span[n]（#cf_span[2 ≤ n ≤ 1, 000]）。\n\n## Output\n\n要输出最终答案，请单独输出字符串 _-1_，然后下一行输出 #cf_span[n] 个整数。第 #cf_span[i] 个整数应为矩阵第 #cf_span[i] 行中除去对角线元素的最小值。*不要忘记刷新你的答案！*\n\n[samples]\n\n## Interaction\n\n要提问，请单独输出一个整数 #cf_span[k]，表示你所选子集的大小。然后下一行输出 #cf_span[k] 个整数 #cf_span[w1, w2, ... wk]。注意，你必须刷新输出才能获得响应。Hongcow 会回复一行包含 #cf_span[n] 个整数。该行中第 #cf_span[i] 个整数表示 #cf_span[Mi, wj] 在 #cf_span[j] 介于 #cf_span[1] 和 #cf_span[k] 时的最小值。你最多只能提问 #cf_span[20] 次，否则你将获得 _Wrong Answer_。要刷新输出，可以在输出一个整数并换行后使用：\n\n_fflush(stdout)_ 在 C++ 中；\n_System.out.flush()_ 在 Java 中；\n_stdout.flush()_ 在 Python 中；\n_flush(output)_ 在 Pascal 中；\n请参阅其他语言的文档。 \n\n*Hacking* 要 Hack 他人，请使用以下格式：\n\nn\nM_{1,1} M_{1,2} ... M_{1,n}\nM_{2,1} M_{2,2} ... M_{2,n}\n...\nM_{n,1} M_{n,2} ... M_{n,n}\n\n当然，参赛程序无法看到此输入。\n\n## Note\n\n在第一个样例中，Hongcow 的隐藏矩阵为 [ [0, 3, 2], [5, 0, 7], [4, 8 ,0], ]\n下面是一个更易读的交互演示。左侧列代表 Hongcow，右侧列代表参赛者。 \n\n3              3              1 2 3\n0 0 0              1              3\n2 7 0              2              1 2\n0 0 4              1              2\n3 0 8              1              1\n0 5 4              -1              2 5 4\n\n对于第二个样例，矩阵的非对角线元素可能为零。","is_translate":true,"language":"Chinese"},{"statement_type":"Markdown","content":"Let $ n \\in \\mathbb{N} $, $ 2 \\leq n \\leq 1000 $.  \nLet $ M \\in \\mathbb{Z}^{n \\times n} $ be a hidden matrix such that:  \n- $ M_{i,i} = 0 $ for all $ i \\in \\{1, 2, \\dots, n\\} $,  \n- $ 0 \\leq M_{i,j} \\leq 10^9 $ for all $ i, j \\in \\{1, 2, \\dots, n\\} $, $ i \\neq j $.\n\nDefine $ r_i = \\min_{j \\neq i} M_{i,j} $ for each $ i \\in \\{1, 2, \\dots, n\\} $.  \nThe goal is to determine the vector $ \\mathbf{r} = (r_1, r_2, \\dots, r_n) $.\n\nYou may query a subset $ S \\subseteq \\{1, 2, \\dots, n\\} $ with $ |S| = k $, $ 1 \\leq k \\leq n $, and receive a response vector $ \\mathbf{v} \\in \\mathbb{Z}^n $, where:  \n$$\nv_i = \\min_{j \\in S} M_{i,j}, \\quad \\text{for each } i \\in \\{1, 2, \\dots, n\\}.\n$$\n\nYou are allowed at most 20 queries.  \nAfter querying, output $-1$ followed by $ \\mathbf{r} $.","is_translate":false,"language":"Formal"}],"meta":{"iden":"CF744B","tags":["bitmasks","divide and conquer","interactive"],"sample_group":[["3\n0 0 0\n2 7 0\n0 0 4\n3 0 8\n0 5 4","3\n1 2 3\n1\n3\n2\n1 2\n1\n2\n1\n1\n-1\n2 5 4"],["2\n0 0\n0 0","1\n2\n1\n1\n-1\n0 0"]],"created_at":"2026-03-03 11:00:39"}}