{"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\"\u003eMemory units are numbered from 1 up to N.\u003cbr\u003eA sequence of memory units is called a memory block. \u003cbr\u003eThe memory control system we consider now has four kinds of operations:\u003cbr\u003e1.\u0026nbsp;\u0026nbsp;Reset Reset all memory units free.\u003cbr\u003e2.\u0026nbsp;\u0026nbsp;New x Allocate a memory block consisted of x continuous free memory units with the least start number\u003cbr\u003e3.\u0026nbsp;\u0026nbsp;Free x Release the memory block which includes unit x\u003cbr\u003e4.\u0026nbsp;\u0026nbsp;Get x Return the start number of the xth memory block(Note that we count the memory blocks allocated from left to right)\u003cbr\u003eWhere 1\u0026lt;\u003dx\u0026lt;\u003dN.You are request to find out the output for M operations. \u003cbr\u003e\u003c/div\u003e"}},{"title":"Input","value":{"format":"HTML","content":"Input contains multiple cases.\u003cbr\u003eEach test case starts with two integer N,M(1\u0026lt;\u003dN,M\u0026lt;\u003d50000) ,indicating that there are N units of memory and M operations.\u003cbr\u003eFollow by M lines,each line contains one operation as describe above.\u003cbr\u003e"}},{"title":"Output","value":{"format":"HTML","content":"For each “Reset” operation, output “Reset Now”.\u003cbr\u003eFor each “New” operation, if it’s possible to allocate a memory block,\u003cbr\u003eoutput “New at A”,where Ais the least start number,otherwise output “Reject New”.\u003cbr\u003eFor each “Free” operation, if it’s possible to find a memory block occupy unit x,\u003cbr\u003eoutput “Free from A to B”,where A and B refer to the start and end number of the memory block,otherwise output “Reject Free”.\u003cbr\u003eFor each “Get” operation, if it’s possible to find the xth memory blocks,\u003cbr\u003eoutput “Get at A”,where A is its start number,otherwise output “Reject Get”.\u003cbr\u003eOutput one blank line after each test case.\u003cbr\u003e"}},{"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\u003e6 10\r\nNew 2\r\nNew 5\r\nNew 2\r\nNew 2\r\nFree 3\r\nGet 1\r\nGet 2\r\nGet 3\r\nFree 3\r\nReset\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003eNew at 1\r\nReject New\r\nNew at 3\r\nNew at 5 \r\nFree from 3 to 4\r\nGet at 1\r\nGet at 5\r\nReject Get\r\nReject Free\r\nReset Now\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}}]}