{"trustable":false,"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":"\u003cscript type\u003d\u0027text/x-mathjax-config\u0027\u003eMathJax.Hub.Config({tex2jax: { inlineMath: [[\u0027$\u0027,\u0027$\u0027]] } }); \u003c/script\u003e\n\u003cscript type\u003d\u0027text/javascript\u0027 src\u003d\u0027https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config\u003dTeX-AMS-MML_HTMLorMML\u0027\u003e\u003c/script\u003e\n\u003cscript type\u003d\u0027text/javascript\u0027\u003esetTimeout(function(){MathJax.Hub.Queue([\u0027Typeset\u0027, MathJax.Hub, \u0027left_view\u0027]);}, 2000);\u003c/script\u003e\n\u003cdiv class\u003d\"panel_content\"\u003e\n Memory units are numbered from 1 up to N. \n \u003cbr\u003eA sequence of memory units is called a memory block. \n \u003cbr\u003eThe memory control system we consider now has four kinds of operations: \n \u003cbr\u003e1.\u0026nbsp;\u0026nbsp;Reset Reset all memory units free. \n \u003cbr\u003e2.\u0026nbsp;\u0026nbsp;New x Allocate a memory block consisted of x continuous free memory units with the least start number \n \u003cbr\u003e3.\u0026nbsp;\u0026nbsp;Free x Release the memory block which includes unit x \n \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) \n \u003cbr\u003eWhere 1\u0026lt;\u003dx\u0026lt;\u003dN.You are request to find out the output for M operations. \n \u003cbr\u003e \n\u003c/div\u003e\n有1-N个连续内存单元格。有4种操作\u003c/br\u003e\n1.Reset,清空所有的内存\u003c/br\u003e\n2.New x,找到连续x个单元格形成一个内存块,输出最小的下标。\u003c/br\u003e\n3.Free x, 释放第x个单元格所在内存块的开始和截止位置。\u003c/br\u003e\n4.Get x,输出第x个内存块从哪个单元格开始的。\u003c/br\u003e\n"}},{"title":"Input","value":{"format":"HTML","content":"Input contains multiple cases. \n\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. \n\u003cbr\u003eFollow by M lines,each line contains one operation as describe above. \n\u003cbr\u003e\n多组输入数据\u003c/br\u003e\n第一行两个整数n和m (n,m\u0026lt;\u003d 50000)\u003c/br\u003e \n接下里m个询问,如题目描述。"}},{"title":"Output","value":{"format":"HTML","content":"For each “Reset” operation, output “Reset Now”. \u003c/br\u003e\n对于Reset操作,输出Reset Now。\u003c/br\u003e\n\u003cbr\u003eFor each “New” operation, if it’s possible to allocate a memory block, \u003c/br\u003e\n\u003cbr\u003eoutput “New at A”,where Ais the least start number,otherwise output “Reject New”. \u003c/br\u003e\n对于New操作,如果可以申请到内存,输出New at A,A表示最小的满足条件的下标。\n否则输出“Reject New”。\u003c/br\u003e\n\u003cbr\u003eFor each “Free” operation, if it’s possible to find a memory block occupy unit x, \n\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”. \u003c/br\u003e\n对于Free如果第x个单元格被使用了,输出Free from A to B,A和B表示使用x单元格的内存块的\n其实和终止位置。如果没有被使用,输出Reject Free\u003c/br\u003e\n\u003cbr\u003eFor each “Get” operation, if it’s possible to find the xth memory blocks, \n\u003cbr\u003eoutput “Get at A”,where A is its start number,otherwise output “Reject Get”. \u003c/br\u003e\n对于Get操作,输出第X个内存块,输出Get at A,找不到输出“Reject Get”\n\u003cbr\u003eOutput one blank line after each test case. \u003c/br\u003e\n每组测试数据后面输出一个空行。\n\u003cbr\u003e"}},{"title":"Sample Input","value":{"format":"HTML","content":"\u003cpre\u003e6 10\nNew 2\nNew 5\nNew 2\nNew 2\nFree 3\nGet 1\nGet 2\nGet 3\nFree 3\nReset\u003c/pre\u003e"}},{"title":"Sample Output","value":{"format":"HTML","content":"\u003cpre\u003eNew at 1\nReject New\nNew at 3\nNew at 5 \nFree from 3 to 4\nGet at 1\nGet at 5\nReject Get\nReject Free\nReset Now\u003c/pre\u003e"}}]}