{"trustable":false,"sections":[{"title":"","value":{"format":"HTML","content":"\n \u003cdiv class\u003d\"ptx\" lang\u003d\"en-US\"\u003e\n Let S \u003d s1 s2...s2n be a well-formed string of parentheses. S can be encoded in two different ways: \n \u003cbr\u003eq By an integer sequence P \u003d p1 p2...pn where pi is the number of left parentheses before the ith right parenthesis in S (P-sequence). \n \u003cbr\u003eq By an integer sequence W \u003d w1 w2...wn where for each right parenthesis, say a in S, we associate an integer which is the number of right parentheses counting from the matched left parenthesis of a up to a. (W-sequence). \n\u003cbr\u003e\nP序列的规则是统计出每个右括号之前的左括号个数作为序列每项的值。\u003cbr\u003e\nW序列的规则是统计每一个右括号和与其匹配的左括号之间所有匹配后的右括号个数.\n \u003cbr\u003e \n \u003cbr\u003eFollowing is an example of the above encodings: \n \u003cbr\u003e\n \u003cpre\u003e\n\u003cbr\u003e\tS\t\t(((()()())))\n\u003cbr\u003e\tP-sequence\t 4 5 6666\n\u003cbr\u003e\tW-sequence\t 1 1 1456\n\u003cbr\u003e\u003c/pre\u003e \n \u003cbr\u003e给你P序列,让你求出W序列\n \u003cbr\u003e\n \u003c/div\u003e"}},{"title":"Input","value":{"format":"HTML","content":"\n \u003cdiv class\u003d\"ptx\" lang\u003d\"en-US\"\u003e\n不想翻译了,输入输出自己看吧呜呜呜\n\u003cbr\u003e \n The first line of the input contains a single integer t (1 \u0026lt;\u003d t \u0026lt;\u003d 10), the number of test cases, followed by the input data for each test case. The first line of each test case is an integer n (1 \u0026lt;\u003d n \u0026lt;\u003d 20), and the second line is the P-sequence of a well-formed string. It contains n positive integers, separated with blanks, representing the P-sequence.\n \u003c/div\u003e"}},{"title":"Output","value":{"format":"HTML","content":"\n \u003cdiv class\u003d\"ptx\" lang\u003d\"en-US\"\u003e\n The output file consists of exactly t lines corresponding to test cases. For each test case, the output line should contain n integers describing the W-sequence of the string corresponding to its given P-sequence.\n \u003c/div\u003e"}},{"title":"Sample Input","value":{"format":"HTML","content":"\u003cpre class\u003d\"sio\"\u003e2\n6\n4 5 6 6 6 6\n9 \n4 6 6 6 6 8 9 9 9\n\u003c/pre\u003e"}},{"title":"Sample Output","value":{"format":"HTML","content":"\u003cpre class\u003d\"sio\"\u003e1 1 1 4 5 6\n1 1 2 4 5 1 1 3 9\u003c/pre\u003e"}}]}