{"trustable":true,"prependHtml":"\u003cstyle type\u003d\"text/css\"\u003e\n section pre {\n display: block;\n padding: 9.5px;\n margin: 0 0 10px;\n font-size: 13px;\n line-height: 1.42857143;\n word-break: break-all;\n word-wrap: break-word;\n color: #333;\n background: rgba(255, 255, 255, 0.5);\n border: 1px solid #ccc;\n border-radius: 6px;\n }\n\u003c/style\u003e\n\u003cscript\u003e\n window.katexOptions \u003d {\n delimiters: [\n {left: \u0027\\\\(\u0027, right: \u0027\\\\)\u0027, display: false},\n {left: \u0027\\\\[\u0027, right: \u0027\\\\]\u0027, display: true}\n ]\n };\n\u003c/script\u003e\n","sections":[{"title":"Problem Statement","value":{"format":"HTML","content":"\r\n\u003csection\u003e\r\n\u003cp\u003eSnuke loves constructing integer sequences.\u003c/p\u003e\r\n\u003cp\u003eThere are \u003cvar\u003e\\(N\\)\u003c/var\u003e piles of stones, numbered \u003cvar\u003e\\(1\\)\u003c/var\u003e through \u003cvar\u003e\\(N\\)\u003c/var\u003e.\r\nThe pile numbered \u003cvar\u003e\\(i\\)\u003c/var\u003e consists of \u003cvar\u003e\\(a_i\\)\u003c/var\u003e stones.\u003c/p\u003e\r\n\u003cp\u003eSnuke will construct an integer sequence \u003cvar\u003e\\(s\\)\u003c/var\u003e of length \u003cvar\u003e\\(Σa_i\\)\u003c/var\u003e, as follows:\u003c/p\u003e\r\n\u003col\u003e\r\n\u003cli\u003eAmong the piles with the largest number of stones remaining, let \u003cvar\u003e\\(x\\)\u003c/var\u003e be the index of the pile with the smallest index. Append \u003cvar\u003e\\(x\\)\u003c/var\u003e to the end of \u003cvar\u003e\\(s\\)\u003c/var\u003e.\u003c/li\u003e\r\n\u003cli\u003eSelect a pile with one or more stones remaining, and remove a stone from that pile.\u003c/li\u003e\r\n\u003cli\u003eIf there is a pile with one or more stones remaining, go back to step 1. Otherwise, terminate the process.\u003c/li\u003e\r\n\u003c/ol\u003e\r\n\u003cp\u003eWe are interested in the lexicographically smallest sequence that can be constructed. For each of the integers \u003cvar\u003e\\(1,2,3,...,N\\)\u003c/var\u003e, how many times does it occur in the lexicographically smallest sequence?\u003c/p\u003e\r\n\u003c/section\u003e\r\n"}},{"title":"Constraints","value":{"format":"HTML","content":"\r\n\u003csection\u003e\r\n\u003cul\u003e\r\n\u003cli\u003e\u003cvar\u003e\\(1 ≤ N ≤ 10^{5}\\)\u003c/var\u003e\u003c/li\u003e\r\n\u003cli\u003e\u003cvar\u003e\\(1 ≤ a_i ≤ 10^{9}\\)\u003c/var\u003e\u003c/li\u003e\r\n\u003c/ul\u003e\r\n\u003c/section\u003e\r\n"}},{"title":"Input","value":{"format":"HTML","content":"\r\n\u003csection\u003e\r\n\u003cp\u003eThe input is given from Standard Input in the following format:\u003c/p\u003e\r\n\u003cpre\u003e\u003cvar\u003e\\(N\\)\u003c/var\u003e\r\n\u003cvar\u003e\\(a_1\\)\u003c/var\u003e \u003cvar\u003e\\(a_2\\)\u003c/var\u003e \u003cvar\u003e\\(...\\)\u003c/var\u003e \u003cvar\u003e\\(a_{N}\\)\u003c/var\u003e\r\n\u003c/pre\u003e\r\n\r\n\u003c/section\u003e\r\n"}},{"title":"Output","value":{"format":"HTML","content":"\r\n\u003csection\u003e\r\n\u003cp\u003ePrint \u003cvar\u003e\\(N\\)\u003c/var\u003e lines. The \u003cvar\u003e\\(i\\)\u003c/var\u003e-th line should contain the number of the occurrences of the integer \u003cvar\u003e\\(i\\)\u003c/var\u003e in the lexicographically smallest sequence that can be constructed.\u003c/p\u003e\r\n\u003c/section\u003e\r\n"}},{"title":"Sample 1","value":{"format":"HTML","content":"\u003ctable class\u003d\u0027vjudge_sample\u0027\u003e\n\u003cthead\u003e\n \u003ctr\u003e\n \u003cth\u003eInput\u003c/th\u003e\n \u003cth\u003eOutput\u003c/th\u003e\n \u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n \u003ctr\u003e\n \u003ctd\u003e\u003cpre\u003e2\r\n1 2\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e2\r\n1\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n\r\n\u003csection\u003e\r\n\r\n\r\n\u003c/section\u003e\r\n\r\n\u003csection\u003e\r\n\r\n\r\n\u003cp\u003eThe lexicographically smallest sequence is constructed as follows:\u003c/p\u003e\r\n\u003cul\u003e\r\n\u003cli\u003eSince the pile with the largest number of stones remaining is pile \u003cvar\u003e\\(2\\)\u003c/var\u003e, append \u003cvar\u003e\\(2\\)\u003c/var\u003e to the end of \u003cvar\u003e\\(s\\)\u003c/var\u003e. Then, remove a stone from pile \u003cvar\u003e\\(2\\)\u003c/var\u003e.\u003c/li\u003e\r\n\u003cli\u003eSince the piles with the largest number of stones remaining are pile \u003cvar\u003e\\(1\\)\u003c/var\u003e and \u003cvar\u003e\\(2\\)\u003c/var\u003e, append \u003cvar\u003e\\(1\\)\u003c/var\u003e to the end of \u003cvar\u003e\\(s\\)\u003c/var\u003e (we take the smallest index). Then, remove a stone from pile \u003cvar\u003e\\(2\\)\u003c/var\u003e.\u003c/li\u003e\r\n\u003cli\u003eSince the pile with the largest number of stones remaining is pile \u003cvar\u003e\\(1\\)\u003c/var\u003e, append \u003cvar\u003e\\(1\\)\u003c/var\u003e to the end of \u003cvar\u003e\\(s\\)\u003c/var\u003e. Then, remove a stone from pile \u003cvar\u003e\\(1\\)\u003c/var\u003e.\u003c/li\u003e\r\n\u003c/ul\u003e\r\n\u003cp\u003eThe resulting sequence is \u003cvar\u003e\\((2,1,1)\\)\u003c/var\u003e. In this sequence, \u003cvar\u003e\\(1\\)\u003c/var\u003e occurs twice, and \u003cvar\u003e\\(2\\)\u003c/var\u003e occurs once.\u003c/p\u003e\r\n\u003c/section\u003e\r\n"}},{"title":"Sample 2","value":{"format":"HTML","content":"\u003ctable class\u003d\u0027vjudge_sample\u0027\u003e\n\u003cthead\u003e\n \u003ctr\u003e\n \u003cth\u003eInput\u003c/th\u003e\n \u003cth\u003eOutput\u003c/th\u003e\n \u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n \u003ctr\u003e\n \u003ctd\u003e\u003cpre\u003e10\r\n1 2 1 3 2 4 2 5 8 1\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e10\r\n7\r\n0\r\n4\r\n0\r\n3\r\n0\r\n2\r\n3\r\n0\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n\r\n\u003csection\u003e\r\n\r\n\r\n\u003c/section\u003e\r\n\r\n\u003csection\u003e\r\n\u003c/section\u003e\r\n"}}]}