{"trustable":false,"sections":[{"title":"","value":{"format":"HTML","content":"\u003cp\u003e定义 S 为一个合法的括号字符串。S 可以用以下两种方式编码:\u003cbr\u003e\n1. 用一个整数数组 P 来表示,其中元素 p[i] 是 S 中每个 \u0027)\u0027 前的 \u0027(\u0027 的个数;\u003cbr\u003e\n2. 用一个整数数组 W 来表示,表示 S 中的第 i 个 \u0027)\u0027 与往前数的第 w[i] 个 \u0027(\u0027 能配对。\u003cbr\u003e\n举个例子:\u003c/p\u003e\n\u003cpre class\u003d\"sio\"\u003e\n\tS (((()()())))\n\tP 4 5 6666\n\tW 1 1 1456\n\u003c/pre\u003e\n你的任务是将 P 数组转换为等价的 W 数组。\n\u003cbr\u003e\u003c/div\u003e"}},{"title":"输入","value":{"format":"HTML","content":"\u003cp\u003e\n第一行一个正整数 t∈[1,10],表示输入数据的组数。\u003cbr\u003e\n每组数据包含两行输入,用来表示采用第 1 种编码方式对 S 进行编码得到的 P 数组:\u003cbr\u003e\n第一行为一个正整数 n∈[1,20] 表示 P 数组数字的个数;\u003cbr\u003e\n第二行为 P 数组的内容。\u003c/p\u003e"}},{"title":"输出","value":{"format":"HTML","content":"\u003cp\u003e每组测试数据输出一行,表示转换后W的内容\u003c/p\u003e"}},{"title":"样例输入","value":{"format":"HTML","content":"\u003cpre style\u003d\"font-family: Consolas, \"Liberation Mono\", Courier, monospace;\n margin: 0 0px;\n padding: 0px 0px;\n white-space: nowrap;\n border: 1px solid #eaeaea;\n background-color: #f8f8f8;\n border-radius: 3px;\"\u003e2\n6\n4 5 6 6 6 6\n9 \n4 6 6 6 6 8 9 9 9\n\u003c/pre\u003e"}},{"title":"样例输出","value":{"format":"HTML","content":"\u003cpre style\u003d\"font-family: Consolas, \"Liberation Mono\", Courier, monospace;\n margin: 0 0px;\n padding: 0px 0px;\n white-space: nowrap;\n border: 1px solid #eaeaea;\n background-color: #f8f8f8;\n border-radius: 3px;\"\u003e1 1 1 4 5 6\n1 1 2 4 5 1 1 3 9\u003c/pre\u003e"}}]}