{"trustable":true,"sections":[{"title":"","value":{"format":"HTML","content":"\u003ch2\u003eProblem G\n \n\u003c/h2\u003e\n\n\u003cp\u003e\n You have drawn a chart of a perfect binary tree, like one shown in Figure G.1. The figure shows a finite tree, but, if needed, you can add more nodes beneath the leaves, making the tree arbitrarily deeper.\n\u003c/p\u003e\n\n\u003ccenter\u003e\n \u003cimg src\u003d\"CDN_BASE_URL/273b5bb76afc31d505c4b13f9ab52d4a?v\u003d1715574324\"\u003e\u003cbr\u003e\n Figure G.1. A Perfect Binary Tree Chart\u003cbr\u003e\n\u003c/center\u003e\u003cbr\u003e\n\n\u003cp\u003e\n Tree nodes are associated with their depths, defined recursively. The root has the depth of zero, and the child nodes of a node of depth d have their depths $d + 1$.\n\u003c/p\u003e\n\n\u003cp\u003eYou also have a pile of a certain number of medals, each engraved with some number. You want to know whether the medals can be placed on the tree chart satisfying the following conditions.\n\u003c/p\u003e\n\n\u003cul\u003e\n \u003cli\u003e A medal engraved with $d$ should be on a node of depth $d$.\u003c/li\u003e\n \u003cli\u003e One tree node can accommodate at most one medal.\u003c/li\u003e\n \u003cli\u003e The path to the root from a node with a medal should not pass through another node with a medal.\u003c/li\u003e\n\u003c/ul\u003e\n\n\u003cp\u003e\n You have to place medals satisfying the above conditions, one by one, starting from the top of the pile down to its bottom. If there exists no placement of a medal satisfying the conditions, you have to throw it away and simply proceed to the next medal.\n\u003c/p\u003e\n\n\u003cp\u003e\n You may have choices to place medals on different nodes. You want to find the best placement. When there are two or more placements satisfying the rule, one that places a medal upper in the pile is better. For example, when there are two placements of four medal, one that places only the top and the 2nd medal, and the other that places the top, the 3rd, and the 4th medal, the former is better.\n\u003c/p\u003e\n\n\n\u003cp\u003e\nIn Sample Input 1, you have a pile of six medals engraved with 2, 3, 1, 1, 4, and 2 again respectively, from top to bottom.\n\u003c/p\u003e\n\n\u003cul\u003e\n \u003cli\u003e The first medal engraved with 2 can be placed, as shown in Figure G.2 (A).\u003c/li\u003e\n \u003cli\u003e Then the second medal engraved with 3 may be placed , as shown in Figure G.2 (B).\u003c/li\u003e\n \u003cli\u003e The third medal engraved with 1 cannot be placed if the second medal were placed as stated above, because both of the two nodes of depth 1 are along the path to the root from nodes already with a medal. Replacing the second medal satisfying the placement conditions, however, enables a placement shown in Figure G.2 (C).\u003c/li\u003e\n \u003cli\u003e The fourth medal, again engraved with 1, cannot be placed with any replacements of the three medals already placed satisfying the conditions. This medal is thus thrown away.\u003c/li\u003e\n \u003cli\u003e The fifth medal engraved with 4 can be placed as shown in of Figure G.2 (D). \u003c/li\u003e\n \u003cli\u003e The last medal engraved with 2 cannot be placed on any of the nodes with whatever replacements.\u003c/li\u003e\n\u003c/ul\u003e\n\n\u003ccenter\u003e\n \u003cimg src\u003d\"CDN_BASE_URL/288a8e44dacfae108c53978999aef598?v\u003d1715574324\"\u003e\u003cbr\u003e\nFigure G.2. Medal Placements\u003cbr\u003e\n\u003c/center\u003e\u003cbr\u003e\n\n\u003ch3\u003eInput\u003c/h3\u003e\n\n\u003cp\u003e\n The input consists of a single test case in the format below.\u003cbr\u003e\n \u003cbr\u003e\n$n$ \u003cbr\u003e\n$x_1$ \u003cbr\u003e\n. \u003cbr\u003e\n. \u003cbr\u003e\n. \u003cbr\u003e\n$x_n$ \u003cbr\u003e\n\u003c/p\u003e\n\n\u003cp\u003e\nThe first line has $n$, an integer representing the number of medals ($1 \\leq n \\leq 5 \\times 10^5$). The following $n$ lines represent the positive integers engraved on the medals. The $i$-th line of which has an integer $x_i$ ($1 \\leq x_i \\leq 10^9$) engraved on the $i$-th medal of the pile from the top.\n\u003c/p\u003e\n\n\n\u003ch3\u003eOutput\u003c/h3\u003e\n\u003cp\u003e\nWhen the best placement is chosen, for each i from 1 through n, output \u003cspan\u003eYes\u003c/span\u003e in a line if the i-th medal is placed; otherwise, output \u003cspan\u003eNo\u003c/span\u003e in a line.\n\u003c/p\u003e\n\n\n\u003ch3\u003eSample Input 1\u003c/h3\u003e\n\n\u003cpre\u003e6\n2\n3\n1\n1\n4\n2\n\u003c/pre\u003e\n\n\u003ch3\u003eSample Output 1\u003c/h3\u003e\n\n\u003cpre\u003eYes\nYes\nYes\nNo\nYes\nNo\u003c/pre\u003e\n\n\u003cbr\u003e\n\n\u003ch3\u003eSample Input 2\u003c/h3\u003e\n\n\u003cpre\u003e10\n4\n4\n4\n4\n4\n4\n4\n4\n1\n4\n\u003c/pre\u003e\n\n\u003ch3\u003eSample Output 2\u003c/h3\u003e\n\n\u003cpre\u003eYes\nYes\nYes\nYes\nYes\nYes\nYes\nYes\nYes\nNo\u003c/pre\u003e\n\n"}}]}