{"trustable":true,"prependHtml":"\u003cscript\u003e window.katexOptions \u003d { disable: true }; \u003c/script\u003e\n\u003cscript type\u003d\"text/x-mathjax-config\"\u003e\n MathJax.Hub.Config({\n tex2jax: {\n inlineMath: [[\u0027$$$\u0027,\u0027$$$\u0027], [\u0027$\u0027,\u0027$\u0027]],\n displayMath: [[\u0027$$$$$$\u0027,\u0027$$$$$$\u0027], [\u0027$$\u0027,\u0027$$\u0027]]\n }\n });\n\u003c/script\u003e\n\u003cscript async src\u003d\"https://mathjax.codeforces.org/MathJax.js?config\u003dTeX-AMS-MML_HTMLorMML\" type\u003d\"text/javascript\"\u003e\u003c/script\u003e","sections":[{"title":"","value":{"format":"HTML","content":"\u003cdiv class\u003d\"panel_content\"\u003eAt the entrance to the university, there is a huge rectangular billboard of size h*w (h is its height and w is its width). The board is the place where all possible announcements are posted: nearest programming competitions, changes in the dining room menu, and other important information.\u003cbr\u003e\u003cbr\u003eOn September 1, the billboard was empty. One by one, the announcements started being put on the billboard.\u003cbr\u003e\u003cbr\u003eEach announcement is a stripe of paper of unit height. More specifically, the i-th announcement is a rectangle of size 1 * wi.\u003cbr\u003e\u003cbr\u003eWhen someone puts a new announcement on the billboard, she would always choose the topmost possible position for the announcement. Among all possible topmost positions she would always choose the leftmost one.\u003cbr\u003e\u003cbr\u003eIf there is no valid location for a new announcement, it is not put on the billboard (that\u0027s why some programming contests have no participants from this university).\u003cbr\u003e\u003cbr\u003eGiven the sizes of the billboard and the announcements, your task is to find the numbers of rows in which the announcements are placed.\u003c/div\u003e"}},{"title":"Input","value":{"format":"HTML","content":"There are multiple cases (no more than 40 cases).\u003cbr\u003e\u003cbr\u003eThe first line of the input file contains three integer numbers, h, w, and n (1 \u0026lt;\u003d h,w \u0026lt;\u003d 10^9; 1 \u0026lt;\u003d n \u0026lt;\u003d 200,000) - the dimensions of the billboard and the number of announcements.\u003cbr\u003e\u003cbr\u003eEach of the next n lines contains an integer number wi (1 \u0026lt;\u003d wi \u0026lt;\u003d 10^9) - the width of i-th announcement."}},{"title":"Output","value":{"format":"HTML","content":"For each announcement (in the order they are given in the input file) output one number - the number of the row in which this announcement is placed. Rows are numbered from 1 to h, starting with the top row. If an announcement can\u0027t be put on the billboard, output \"-1\" for this announcement."}},{"title":"Sample","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\u003e3 5 5\r\n2\r\n4\r\n3\r\n3\r\n3\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e1\r\n2\r\n1\r\n3\r\n-1\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}}]}