{"trustable":true,"prependHtml":"\u003cscript\u003e\n window.katexOptions \u003d {\n delimiters: [\n {left: \u0027\\\\(\u0027, right: \u0027\\\\)\u0027, display: false},\n ]\n };\n\u003c/script\u003e\n","sections":[{"title":"","value":{"format":"HTML","content":"\u003cp\u003e\n\u003cem\u003eGensokyo\u003c/em\u003e is a world which exists quietly beside ours, separated by a mystical border. It is a utopia where humans and other beings such as fairies, \u003cem\u003eyoukai\u003c/em\u003e(phantoms), and gods live peacefully together. Shameimaru Aya is a crow tengu with the ability to manipulate wind who has been in \u003cem\u003eGensokyo\u003c/em\u003e for over 1000 years. She runs the Bunbunmaru News - a newspaper chock-full of rumors, and owns the \u003cem\u003eBunkachou\u003c/em\u003e - her record of interesting observations for Bunbunmaru News articles and pictures of beautiful \u003cem\u003edanmaku\u003c/em\u003e(barrange) or cute girls living in \u003cem\u003eGensokyo\u003c/em\u003e. She is the biggest connoisseur of rumors about the girls of \u003cem\u003eGensokyo\u003c/em\u003e among the tengu. Her intelligence gathering abilities are the best in \u003cem\u003eGensokyo\u003c/em\u003e!\n\u003c/p\u003e\n\n\u003cp\u003e\n\u003c!--\u003ccenter\u003e\u003cimg src\u003d\"shoot_the_bullet_0.jpg\"/\u003e\u003c/center\u003e--\u003e\n\u003c/p\u003e\u003ccenter\u003e\u003cimg src\u003d\"CDN_BASE_URL/f0d93716e89b5d75f6a080cdb3fc8304?v\u003d1714061178\"\u003e\u003c/center\u003e\n\u003cp\u003e\u003c/p\u003e\n\n\u003cp\u003e\nDuring the coming \u003ci\u003en\u003c/i\u003e days, Aya is planning to take many photos of \u003ci\u003em\u003c/i\u003e cute girls living in \u003cem\u003eGensokyo\u003c/em\u003e to write Bunbunmaru News daily and record at least \u003ci\u003eG\u003csub\u003ex\u003c/sub\u003e\u003c/i\u003e photos of girl \u003ci\u003ex\u003c/i\u003e in total in the \u003cem\u003eBunkachou\u003c/em\u003e. At the \u003ci\u003ek\u003c/i\u003e-th day, there are \u003ci\u003eC\u003csub\u003ek\u003c/sub\u003e\u003c/i\u003e targets, \u003ci\u003eT\u003csub\u003ek1\u003c/sub\u003e\u003c/i\u003e, \u003ci\u003eT\u003csub\u003ek2\u003c/sub\u003e\u003c/i\u003e, ..., \u003ci\u003eT\u003csub\u003ekC\u003csub\u003ek\u003c/sub\u003e\u003c/sub\u003e\u003c/i\u003e. The number of photos of target \u003ci\u003eT\u003csub\u003eki\u003c/sub\u003e\u003c/i\u003e that Aya takes should be in range [\u003ci\u003eL\u003csub\u003eki\u003c/sub\u003e\u003c/i\u003e, \u003ci\u003eR\u003csub\u003eki\u003c/sub\u003e\u003c/i\u003e], if less, Aya cannot write an interesting article, if more, the girl will become angry and use her \u003cem\u003elast spell card\u003c/em\u003e to attack Aya. What\u0027s more, Aya cannot take more than \u003ci\u003eD\u003csub\u003ek\u003c/sub\u003e\u003c/i\u003e photos at the \u003ci\u003ek\u003c/i\u003e-th day. \u003cstrong\u003eUnder these constraints, the more photos, the better\u003c/strong\u003e.\n\u003c/p\u003e\n\n\u003cp\u003e\nAya is not good at solving this complex problem. So she comes to you, an earthling, for help.\n\u003c/p\u003e\n\n\u003cp\u003e\u003cb\u003eInput\u003c/b\u003e\u003c/p\u003e\n\n\u003cp\u003e\nThere are about 40 cases. Process to the end of file. \n\u003c/p\u003e\n\n\u003cp\u003e\nEach case begins with two integers 1 \u0026lt;\u003d \u003ci\u003en\u003c/i\u003e \u0026lt;\u003d 365, 1 \u0026lt;\u003d \u003ci\u003em\u003c/i\u003e \u0026lt;\u003d 1000. Then \u003ci\u003em\u003c/i\u003e integers, \u003ci\u003eG\u003csub\u003e1\u003c/sub\u003e\u003c/i\u003e, \u003ci\u003eG\u003csub\u003e2\u003c/sub\u003e\u003c/i\u003e, ..., \u003ci\u003eG\u003csub\u003em\u003c/sub\u003e\u003c/i\u003e in range [0, 10000]. Then \u003ci\u003en\u003c/i\u003e days. Each day begins with two integer 1 \u0026lt;\u003d \u003ci\u003eC\u003c/i\u003e \u0026lt;\u003d 100, 0 \u0026lt;\u003d \u003ci\u003eD\u003c/i\u003e \u0026lt;\u003d 30000. Then \u003ci\u003eC\u003c/i\u003e \u003cstrong\u003edifferent\u003c/strong\u003e targets. Each target is described by three integers, 0 \u0026lt;\u003d \u003ci\u003eT\u003c/i\u003e \u0026lt; \u003ci\u003em\u003c/i\u003e, 0 \u0026lt;\u003d \u003ci\u003eL\u003c/i\u003e \u0026lt;\u003d \u003ci\u003eR\u003c/i\u003e \u0026lt;\u003d 100.\n\u003c/p\u003e\n\n\u003cp\u003e\u003cb\u003eOutput\u003c/b\u003e\u003c/p\u003e\n\n\u003cp\u003e\nFor each case, first output the number of photos Aya can take, \u003cstrong\u003e-1 if it\u0027s impossible to satisfy her needing\u003c/strong\u003e. If there is a best strategy, output the number of photos of each girl Aya should take at each day on separate lines. The output must be in the same order as the input. If there are more than one best strategy, any one will be OK.\n\u003c/p\u003e\n\n\u003cp\u003e\nOutput a blank line after each case.\n\u003c/p\u003e\n\n\u003cp\u003e\u003cb\u003eSample Input\u003c/b\u003e\u003c/p\u003e\n\n\u003cpre\u003e2 3\n12 12 12\n3 18\n0 3 9\n1 3 9\n2 3 9\n3 18\n0 3 9\n1 3 9\n2 3 9\n\n2 3\n12 12 12\n3 18\n0 3 9\n1 3 9\n2 3 9\n3 18\n0 0 3\n1 3 6\n2 6 9\n\n2 3\n12 12 12\n3 15\n0 3 9\n1 3 9\n2 3 9\n3 21\n0 0 3\n1 3 6\n2 6 12\n\n\u003c/pre\u003e\n\n\u003cp\u003e\u003cb\u003eSample Output\u003c/b\u003e\u003c/p\u003e\n\n\u003cpre\u003e36\n6\n6\n6\n6\n6\n6\n\n36\n9\n6\n3\n3\n6\n9\n\n-1\n\n\u003c/pre\u003e\n\n\u003cp\u003e\u003cb\u003eExternal Links\u003c/b\u003e\u003c/p\u003e\n\n\u003cp\u003e\n\u003ca target\u003d\"_blank\" href\u003d\"http://www16.big.or.jp/~zun/\"\u003e\n\t\u003cimg alt\u003d\"TeamShanghaiAlice(banner)\" src\u003d\"CDN_BASE_URL/a87807d461d30befc4a8840a002e5cb6?v\u003d1714061178\"\u003e\n\u003c/a\u003e\u003cbr\u003e\n\u003ca target\u003d\"_blank\" href\u003d\"http://en.wikipedia.org/wiki/Shoot_the_Bullet\"\u003eWikipedia\u003c/a\u003e\u003cbr\u003e\n\u003ca target\u003d\"_blank\" href\u003d\"http://touhou.wikia.com/wiki/Shoot_the_Bullet\"\u003eTouhou Wiki\u003c/a\u003e\u003cbr\u003e\n\u003c/p\u003e\n\n\u003c!--\nvim: ft\u003dhtml\n--\u003e\n\n"}}]}