{"raw_statement":[{"iden":"statement","content":"You are given an integer array of length $n$.\n\nYou have to choose some subsequence of this array of maximum length such that this subsequence forms a increasing sequence of consecutive integers. In other words the required sequence should be equal to $[x, x + 1, \\dots, x + k - 1]$ for some value $x$ and length $k$.\n\nSubsequence of an array can be obtained by erasing some (possibly zero) elements from the array. You can erase any elements, not necessarily going successively. The remaining elements preserve their order. For example, for the array $[5, 3, 1, 2, 4]$ the following arrays are subsequences: $[3]$, $[5, 3, 1, 2, 4]$, $[5, 1, 4]$, but the array $[1, 3]$ is not."},{"iden":"input","content":"The first line of the input containing integer number $n$ ($1 \\le n \\le 2 \\cdot 10^5$) — the length of the array. The second line of the input containing $n$ integer numbers $a_1, a_2, \\dots, a_n$ ($1 \\le a_i \\le 10^9$) — the array itself."},{"iden":"output","content":"On the first line print $k$ — the maximum length of the subsequence of the given array that forms an increasing sequence of consecutive integers.\n\nOn the second line print the sequence of the indices of the **any** maximum length subsequence of the given array that forms an increasing sequence of consecutive integers."},{"iden":"examples","content":"Input\n\n7\n3 3 4 7 5 6 8\n\nOutput\n\n4\n2 3 5 6 \n\nInput\n\n6\n1 3 5 2 4 6\n\nOutput\n\n2\n1 4 \n\nInput\n\n4\n10 9 8 7\n\nOutput\n\n1\n1 \n\nInput\n\n9\n6 7 8 3 4 5 9 10 11\n\nOutput\n\n6\n1 2 3 7 8 9"},{"iden":"note","content":"All valid answers for the first example (as sequences of indices):\n\n*   $[1, 3, 5, 6]$\n*   $[2, 3, 5, 6]$\n\nAll valid answers for the second example:\n\n*   $[1, 4]$\n*   $[2, 5]$\n*   $[3, 6]$\n\nAll valid answers for the third example:\n\n*   $[1]$\n*   $[2]$\n*   $[3]$\n*   $[4]$\n\nAll valid answers for the fourth example:\n\n*   $[1, 2, 3, 7, 8, 9]$"}],"translated_statement":"[{\"iden\":\"statement\",\"content\":\"你被给定一个长度为 $n$ 的整数数组。\\n\\n你需要从中选择一个最长的子序列，使得该子序列构成一个连续整数的递增序列。换句话说，所需序列应形如 $[ x, x + 1, dots.h, x + k -1 ]$，其中 $x$ 为某个值，$k$ 为长度。\\n\\n数组的子序列可以通过删除数组中的某些（可能为零个）元素获得。你可以删除任意元素，不必连续删除。剩余元素保持原有顺序。例如，对于数组 $[ 5, 3, 1, 2, 4 ]$，以下数组是其子序列：$[ 3 ]$、$[ 5, 3, 1, 2, 4 ]$、$[ 5, 1, 4 ]$，但数组 $[ 1, 3 ]$ 不是。\\n\\n输入的第一行包含一个整数 $n$（$1 lt.eq n lt.eq 2 dot.op 10^5$）——数组的长度。第二行包含 $n$ 个整数 $a_1, a_2, dots.h, a_n$（$1 lt.eq a_i lt.eq 10^9$）——数组本身。\\n\\n第一行输出 $k$ —— 给定数组中能构成连续整数递增序列的子序列的最大长度。\\n\\n第二行输出构成这样一个最大长度子序列的任意一组元素的下标序列。\"},{\"iden\":\"input\",\"content\":\"输入的第一行包含一个整数 $n$（$1 lt.eq n lt.eq 2 dot.op 10^5$）——数组的长度。第二行包含 $n$ 个整数 $a_1, a_2, dots.h, a_n$（$1 lt.eq a_i lt.eq 10^9$）——数组本身。\"},{\"iden\":\"output\",\"content\":\"第一行输出 $k$ —— 给定数组中能构成连续整数递增序列的子序列的最大长度。\\n\\n第二行输出构成这样一个最大长度子序列的任意一组元素的下标序列。\"},{\"iden\":\"examples\",\"content\":\"输入\\n7\\n3 3 4 7 5 6 8\\n输出\\n4\\n2 3 5 6\\n\\n输入\\n6\\n1 3 5 2 4 6\\n输出\\n2\\n1 4\\n\\n输入\\n4\\n10 9 8 7\\n输出\\n1\\n1\\n\\n输入\\n9\\n6 7 8 3 4 5 9 10 11\\n输出\\n6\\n1 2 3 7 8 9 \"},{\"iden\":\"note\",\"content\":\"第一个示例的所有有效答案（作为下标序列）：\\n\\n$[ 1, 3, 5, 6 ]$\\n\\n$[ 2, 3, 5, 6 ]$\\n\\n第二个示例的所有有效答案：\\n\\n$[ 1, 4 ]$\\n\\n$[ 2, 5 ]$\\n\\n$[ 3, 6 ]$\\n\\n第三个示例的所有有效答案：\\n\\n$[ 1 ]$\\n\\n$[ 2 ]$\\n\\n$[ 3 ]$\\n\\n$[ 4 ]$\\n\\n第四个示例的所有有效答案：\\n\\n$[ 1, 2, 3, 7, 8, 9 ]$ \"}]\n\n]","sample_group":[],"show_order":[],"formal_statement":"**Definitions**  \nLet $ n \\in \\mathbb{Z}^+ $ be the length of the array.  \nLet $ A = (a_1, a_2, \\dots, a_n) $ be a sequence of integers, where $ a_i \\in \\mathbb{Z} $ and $ 1 \\leq a_i \\leq 10^9 $.\n\nA *consecutive increasing subsequence* is a subsequence $ (a_{i_1}, a_{i_2}, \\dots, a_{i_k}) $ with $ i_1 < i_2 < \\dots < i_k $ such that for some $ x \\in \\mathbb{Z} $,  \n$$\na_{i_j} = x + j - 1 \\quad \\text{for all } j \\in \\{1, 2, \\dots, k\\}.\n$$\n\n**Constraints**  \n1. $ 1 \\leq n \\leq 2 \\cdot 10^5 $  \n2. $ 1 \\leq a_i \\leq 10^9 $ for all $ i \\in \\{1, \\dots, n\\} $\n\n**Objective**  \nFind the maximum length $ k $ of such a consecutive increasing subsequence, and return any set of indices $ (i_1, i_2, \\dots, i_k) $ with $ i_1 < i_2 < \\dots < i_k $ such that the corresponding subsequence is $ [x, x+1, \\dots, x+k-1] $ for some $ x \\in \\mathbb{Z} $.","simple_statement":null,"has_page_source":false}