{"id":761,"date":"2013-06-27T01:44:50","date_gmt":"2013-06-26T17:44:50","guid":{"rendered":"http:\/\/www.shuizilong.com\/house\/?p=761"},"modified":"2013-06-27T02:35:57","modified_gmt":"2013-06-26T18:35:57","slug":"hdu-2871-memory-control","status":"publish","type":"post","link":"https:\/\/www.shuizilong.com\/house\/archives\/hdu-2871-memory-control\/","title":{"rendered":"HDU 2871. Memory Control"},"content":{"rendered":"<p><!--more--><\/p>\n<h3>Brief description: <\/h3>\n<p>Memory units are numbered from 1 up to N. A sequence of memory units is called a memory block.<br \/>\nThe memory control system we consider now has four kinds of operations:<\/p>\n<ol>\n<li><code>Reset<\/code>: Reset all memory units free. For each <code>Reset<\/code> operation, output <code>Reset Now<\/code>.<\/li>\n<li><code>New x<\/code>: Allocate a memory block consisted of x continuous free memory units with the least start number. For each <code>New<\/code> operation, if it\u2019s possible to allocate a memory block, output <code>New at A<\/code>, where A is the least start number, otherwise output <code>Reject New<\/code>.<\/li>\n<li><code>Free x<\/code>: Release the memory block which includes unit x. For each <code>Free<\/code> operation, if it\u2019s possible to find a memory block occupy unit x, output <code>Free from A to B<\/code>, where A and B refer to the start and end number of the memory block, otherwise output <code>Reject Free<\/code>.<\/li>\n<li><code>Get x<\/code>: Return the start number of the <font style=\"color: red\">xth<\/font> memory block(Note that we count the memory blocks allocated from left to right). For each <code>Get<\/code> operation, if it\u2019s possible to find the xth memory blocks, output <code>Get at A<\/code>, where A is its start number, otherwise output <code>Reject Get<\/code>.<\/li>\n<p>Where 1<=x<=N. You are request to find out the output for M operations. Output one blank line after each test case.\n<\/ol>\n<h3>Analysis: <\/h3>\n<p>&#8230; \u7565\uff09<br \/>\n<a href=\"http:\/\/acm.hust.edu.cn\/vjudge\/contest\/viewSource.action?id=1236087\">http:\/\/acm.hust.edu.cn\/vjudge\/contest\/viewSource.action?id=1236087<\/a><\/p>\n<h3>External link: <\/h3>\n<p>&#8230;<\/p>\n","protected":false},"excerpt":{"rendered":"","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","enabled":false}}},"categories":[47],"tags":[],"class_list":["post-761","post","type-post","status-publish","format-standard","hentry","category-hdu"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p2tdP7-ch","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.shuizilong.com\/house\/wp-json\/wp\/v2\/posts\/761","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.shuizilong.com\/house\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.shuizilong.com\/house\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.shuizilong.com\/house\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.shuizilong.com\/house\/wp-json\/wp\/v2\/comments?post=761"}],"version-history":[{"count":1,"href":"https:\/\/www.shuizilong.com\/house\/wp-json\/wp\/v2\/posts\/761\/revisions"}],"predecessor-version":[{"id":762,"href":"https:\/\/www.shuizilong.com\/house\/wp-json\/wp\/v2\/posts\/761\/revisions\/762"}],"wp:attachment":[{"href":"https:\/\/www.shuizilong.com\/house\/wp-json\/wp\/v2\/media?parent=761"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.shuizilong.com\/house\/wp-json\/wp\/v2\/categories?post=761"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.shuizilong.com\/house\/wp-json\/wp\/v2\/tags?post=761"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}