{"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接下来每两行表示一个用P法表示数据组\u003cbr\u003e\n\u0026nbsp\u0026nbsp\u0026nbsp第一行一个正整数n∈[1,20]表示P数组数字的个数\u003cbr\u003e\n\u0026nbsp\u0026nbsp\u0026nbsp第二行表示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"}}]}