{"trustable":false,"prependHtml":"\u003cstyle type\u003d\u0027text/css\u0027\u003e\n .input, .output {\n border: 1px solid #888888;\n }\n .output {\n margin-bottom: 1em;\n position: relative;\n top: -1px;\n }\n .output pre, .input pre {\n background-color: #EFEFEF;\n line-height: 1.25em;\n margin: 0;\n padding: 0.25em;\n }\n \u003c/style\u003e\n \u003clink rel\u003d\"stylesheet\" href\u003d\"//codeforces.org/s/96598/css/problem-statement.css\" type\u003d\"text/css\" /\u003e\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 type\u003d\"text/javascript\" async src\u003d\"https://mathjax.codeforces.org/MathJax.js?config\u003dTeX-AMS_HTML-full\"\u003e\u003c/script\u003e","sections":[{"title":"","value":{"format":"MD","content":"## 题目描述\n\n有一个宽度为 $n$ 的河流。河流的左岸是第 $0$ 个单元格,右岸是第 $n + 1$ 个单元格(更确切地说,河流可以表示为从 $0$ 到 $n + 1$ 编号的 $n + 2$ 个单元格的序列)。河流上还有 $m$ 个木板平台,第 $i$ 个平台的长度为 $c_i$(因此第 $i$ 个平台占用河流的 $c_i$ 个连续单元格)。保证平台长度之和不超过 $n$。\n\n你站在第 $0$ 个位置,想办法到达第 $n+1$ 个位置。如果你站在位置 $x$,你可以跳到范围 $[x + 1, x + d]$ 内的任何位置。**然而**你不太喜欢水,所以你只能跳到属于某个木板平台的单元格上。例如,如果 $d\u003d1$,你只能跳到下一个位置(如果它属于木板平台的话)。**可以假设单元格 $0$ 和 $n+1$ 属于木板平台**。\n\n你想知道是否可以通过将平台任意次数(可能为零)地向左或向右移动,只要它们不相交(但两个平台可以相接),就能从 $0$ 跳到 $n+1$。这也意味着你不能改变平台的相对顺序。\n\n**请注意,你应该在开始跳跃之前就先移动平台**。\n\n例如,如果 $n\u003d7$,$m\u003d3$,$d\u003d2$,$c \u003d [1, 2, 1]$,那么从 $0$ 到达 $8$ 的一种方法是:\n\n![](https://espresso.codeforces.com/270b7d9b2425a337237627a794410070fe16cd5b.png)\n\n## 输入格式\n\n输入的第一行包含三个整数 $n$,$m$ 和 $d$($1 \\le n, m, d \\le 1000$,$m \\le n$)——河流的宽度、平台的数量和你的跳跃最大距离。\n\n输入的第二行包含 $m$ 个整数 $c_1, c_2, \\dots, c_m$($1 \\le c_i \\le n$,$\\sum\\limits_{i\u003d1}^{m} c_i \\le n$),其中 $c_i$ 是第 $i$ 个平台的长度。\n\n## 输出格式\n\n如果无法从 $0$ 到达 $n+1$,则在第一行中输出 `NO`。否则,在第一行中输出 `YES`,第二行中输出长度为 $n$ 的数组 $a$,即河流单元格的序列(不包括单元格 $0$ 和单元格 $n + 1$)。\n\n如果单元格 $i$ 不属于任何平台,$a_i$ 应该为 $0$。否则,它应该等于单元格 $i$ 所属的平台的索引(从 $1$ 起始,平台按输入顺序编号)。\n\n请注意,所有等于 $1$ 的 $a_i$ 应该形成一个长度为 $c_1$ 的连续子段,所有等于 $2$ 的 $a_i$ 应该形成一个长度为 $c_2$ 的连续子段,$\\dots$,所有等于 $m$ 的 $a_i$ 应该形成一个长度为 $c_m$ 的连续子段。数组 $a$ 中 $2$ 的最左位置应大于 $1$ 的最右位置,数组 $a$ 中 $3$ 的最左位置应大于 $2$ 的最右位置,$\\dots$,数组 $a$ 中 $m$ 的最左位置应大于 $m-1$ 的最右位置。\n\n为了更好地理解,请参考样例输出。\n\n## 样例输入 1\n\n```\n7 3 2\n1 2 1\n```\n\n## 样例输出 1\n\n```\nYES\n0 1 0 2 2 0 3 \n```\n\n## 样例输入 2\n\n```\n10 1 11\n1\n```\n\n## 样例输出 2\n\n```\nYES\n0 0 0 0 0 0 0 0 0 1 \n```\n\n## 样例输入 3\n\n```\n10 1 5\n2\n```\n\n## 样例输出 3\n\n```\nYES\n0 0 0 0 1 1 0 0 0 0 \n```\n\n## 提示\n\n考虑第一个样例:答案是 $[0, 1, 0, 2, 2, 0, 3]$。你执行的跳跃序列是 $0 \\rightarrow 2 \\rightarrow 4 \\rightarrow 5 \\rightarrow 7 \\rightarrow 8$。\n\n考虑第二个例子:不管如何放置平台,你总可以从 $0$ 跳到 $11$。\n\n考虑第三个例子:答案是 $[0, 0, 0, 0, 1, 1, 0, 0, 0, 0]$。你执行的跳跃序列是 $0 \\rightarrow 5 \\rightarrow 6 \\rightarrow 11$。\n\n\n\u003cp\u003eThere is a river of width $$$n$$$. The left bank of the river is cell $$$0$$$ and the right bank is cell $$$n + 1$$$ (more formally, the river can be represented as a sequence of $$$n + 2$$$ cells numbered from $$$0$$$ to $$$n + 1$$$). There are also $$$m$$$ wooden platforms on a river, the $$$i$$$-th platform has length $$$c_i$$$ (so the $$$i$$$-th platform takes $$$c_i$$$ consecutive cells of the river). It is guaranteed that the sum of lengths of platforms does not exceed $$$n$$$.\u003c/p\u003e\n\u003cp\u003eYou are standing at $$$0$$$ and want to reach $$$n+1$$$ somehow. If you are standing at the position $$$x$$$, you can jump to any position in the range $$$[x + 1; x + d]$$$. \u003cspan class\u003d\"tex-font-style-bf\"\u003eHowever\u003c/span\u003e you don\u0027t really like the water so you can jump only to such cells that belong to some wooden platform. For example, if $$$d\u003d1$$$, you can jump only to the next position (if it belongs to the wooden platform). \u003cspan class\u003d\"tex-font-style-bf\"\u003eYou can assume that cells $$$0$$$ and $$$n+1$$$ belong to wooden platforms\u003c/span\u003e.\u003c/p\u003e\n\u003cp\u003eYou want to know if it is possible to reach $$$n+1$$$ from $$$0$$$ if you can move any platform to the left or to the right arbitrary number of times (possibly, zero) as long as they do not intersect each other (but two platforms can touch each other). It also means that you cannot change the relative order of platforms.\u003c/p\u003e\n\u003cp\u003e\u003cspan class\u003d\"tex-font-style-bf\"\u003eNote that you should move platforms until you start jumping\u003c/span\u003e (in other words, you first move the platforms and then start jumping).\u003c/p\u003e\n\u003cp\u003eFor example, if $$$n\u003d7$$$, $$$m\u003d3$$$, $$$d\u003d2$$$ and $$$c \u003d [1, 2, 1]$$$, then one of the ways to reach $$$8$$$ from $$$0$$$ is follow:\u003c/p\u003e\n\u003ccenter\u003e\n \u003cimg class\u003d\"tex-graphics\" src\u003d\"CDN_BASE_URL/4c010fd06eb422c2ca6892e103fda29c?v\u003d1694677518\" style\u003d\"max-width: 100.0%;max-height: 100.0%;\"\u003e \u003cspan class\u003d\"tex-font-size-small\"\u003eThe first example: $$$n\u003d7$$$.\u003c/span\u003e\n\u003c/center\u003e"}},{"title":"Input","value":{"format":"MD","content":"\u003cp\u003eThe first line of the input contains three integers $$$n$$$, $$$m$$$ and $$$d$$$ ($$$1 \\le n, m, d \\le 1000, m \\le n$$$) — the width of the river, the number of platforms and the maximum distance of your jump, correspondingly.\u003c/p\u003e\n\u003cp\u003eThe second line of the input contains $$$m$$$ integers $$$c_1, c_2, \\dots, c_m$$$ ($$$1 \\le c_i \\le n, \\sum\\limits_{i\u003d1}^{m} c_i \\le n$$$), where $$$c_i$$$ is the length of the $$$i$$$-th platform.\u003c/p\u003e"}},{"title":"Output","value":{"format":"MD","content":"\u003cp\u003eIf it is impossible to reach $$$n+1$$$ from $$$0$$$, print \u003cspan class\u003d\"tex-font-style-tt\"\u003eNO\u003c/span\u003e in the first line. Otherwise, print \u003cspan class\u003d\"tex-font-style-tt\"\u003eYES\u003c/span\u003e in the first line and the array $$$a$$$ of length $$$n$$$ in the second line — the sequence of river cells (excluding cell $$$0$$$ and cell $$$n + 1$$$).\u003c/p\u003e\n\u003cp\u003eIf the cell $$$i$$$ does not belong to any platform, $$$a_i$$$ should be $$$0$$$. Otherwise, it should be equal to the index of the platform ($$$1$$$-indexed, platforms are numbered from $$$1$$$ to $$$m$$$ in order of input) to which the cell $$$i$$$ belongs.\u003c/p\u003e\n\u003cp\u003e\u003cspan class\u003d\"tex-font-style-bf\"\u003eNote that\u003c/span\u003e all $$$a_i$$$ equal to $$$1$$$ should form a contiguous subsegment of the array $$$a$$$ of length $$$c_1$$$, all $$$a_i$$$ equal to $$$2$$$ should form a contiguous subsegment of the array $$$a$$$ of length $$$c_2$$$, ..., all $$$a_i$$$ equal to $$$m$$$ should form a contiguous subsegment of the array $$$a$$$ of length $$$c_m$$$. The leftmost position of $$$2$$$ in $$$a$$$ should be greater than the rightmost position of $$$1$$$, the leftmost position of $$$3$$$ in $$$a$$$ should be greater than the rightmost position of $$$2$$$, ..., the leftmost position of $$$m$$$ in $$$a$$$ should be greater than the rightmost position of $$$m-1$$$.\u003c/p\u003e\n\u003cp\u003eSee example outputs for better understanding.\u003c/p\u003e"}},{"title":"Sample 1","value":{"format":"MD","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\u003e7 3 2\n1 2 1\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003eYES\n0 1 0 2 2 0 3 \n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}},{"title":"Sample 2","value":{"format":"MD","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 1 11\n1\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003eYES\n0 0 0 0 0 0 0 0 0 1 \n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}},{"title":"Sample 3","value":{"format":"MD","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 1 5\n2\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003eYES\n0 0 0 0 1 1 0 0 0 0 \n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}},{"title":"Note","value":{"format":"MD","content":"\u003cp\u003eConsider the first example: the answer is $$$[0, 1, 0, 2, 2, 0, 3]$$$. The sequence of jumps you perform is $$$0 \\rightarrow 2 \\rightarrow 4 \\rightarrow 5 \\rightarrow 7 \\rightarrow 8$$$.\u003c/p\u003e\n\u003cp\u003eConsider the second example: it does not matter how to place the platform because you always can jump from $$$0$$$ to $$$11$$$.\u003c/p\u003e\n\u003cp\u003eConsider the third example: the answer is $$$[0, 0, 0, 0, 1, 1, 0, 0, 0, 0]$$$. The sequence of jumps you perform is $$$0 \\rightarrow 5 \\rightarrow 6 \\rightarrow 11$$$.\u003c/p\u003e"}}]}