{"id":192,"date":"2012-10-13T10:21:00","date_gmt":"2012-10-13T02:21:00","guid":{"rendered":"http:\/\/nike0good.jp1.rpvhost.net\/97"},"modified":"2012-10-13T10:21:00","modified_gmt":"2012-10-13T02:21:00","slug":"monster_greedy","status":"publish","type":"post","link":"https:\/\/nike0good.com\/?p=192","title":{"rendered":"Monster (\u8d2a\u5fc3\uff09"},"content":{"rendered":"<p align=\"center\"><strong>Monster<\/strong><\/p>\n<p>\u3010\u9898\u76ee\u63cf\u8ff0\u3011<\/p>\n<p>\u660e\u660e\u7684\u624b\u673a\u4e0a\u6709\u8fd9\u6837\u4e00\u4e2a\u6e38\u620f\uff0c\u6709\u4e00\u6392n\u4e2a\u602a\u7269\uff0c\u6bcf\u4e2a\u602a\u7269\u7684\u8840\u91cf\u662fm<sub>i<\/sub>\u3002\u73b0\u5728\u660e\u660e\u53ef\u4ee5\u5c04\u51fak\u4e2a\u4f24\u5bb3\u5747\u4e3ap\u7684\u706b\u7403\u5c04\u5411\u67d0\u4e9b\u602a\u7269\u3002\u5f53\u67d0\u4e2a\u706b\u7403\u5c04\u5230\u7b2ci\u4e2a\u602a\u7269\uff0c\u9664\u4e86\u8fd9\u4e2a\u602a\u7269\u4f1a\u6389\u8840p\u4ee5\u5916\uff0c\u5b83\u5de6\u8fb9\u7684\u7b2cj\u4e2a\u602a\u7269(j&lt;=i)\uff0c\u4e5f\u4f1a\u906d\u5230Max(0,&nbsp;<em>p<\/em>&nbsp;- (<em>i<\/em>&nbsp;-&nbsp;<em>j<\/em>)* (<em>i<\/em>&nbsp;-&nbsp;<em>j<\/em>))\u7684\u6e85\u5c04\u4f24\u5bb3\u3002\u5f53\u67d0\u4e2a\u602a\u7269\u7684\u8840\u91cf\u4e3a\u8d1f\u7684\u65f6\u5019\uff0c\u5b83\u5c31\u6b7b\u4e86\uff0c\u4f46\u5b83\u7684\u5c38\u4f53\u5df2\u7136\u5b58\u5728\uff0c\u5373\u5176\u4ed6\u602a\u7269\u4e0d\u4f1a\u56e0\u4e3a\u5b83\u6b7b\u800c\u6539\u53d8\u4f4d\u7f6e\u3002<\/p>\n<p>\u660e\u660e\u60f3\u7528\u8fd9k \u4e2a\u706b\u7403\u6d88\u706d\u6389\u6240\u6709\u7684\u602a\u7269\uff0c\u4f46\u4ed6\u540c\u65f6\u5e0c\u671b\u6bcf\u4e2a\u706b\u7403\u7684\u4f24\u5bb3p\u80fd\u5c3d\u53ef\u80fd\u7684\u5c0f\uff0c\u8fd9\u6837\u4ed6\u624d\u80fd\u5b8c\u7f8e\u8fc7\u5173\u3002<\/p>\n<p>\u3010\u8f93\u5165\u6570\u636e\u3011<\/p>\n<p>\u7b2c\u4e00\u884c\u4e24\u4e2a\u6570&nbsp;<em>n<\/em>,&nbsp;<em>k<\/em>&nbsp;(1\u2264&nbsp;<em>n<\/em>&nbsp;\u2264 50000, 1 \u2264&nbsp;<em>k<\/em>&nbsp;\u2264 100000)\u3002<\/p>\n<p>\u7b2c\u4e8c\u884cn\u4e2a\u6570<em>m<sub>1<\/sub><\/em>,&nbsp;<em>m<sub>2<\/sub><\/em>,...<em>m<sub>n<\/sub><\/em>&nbsp;(1 \u2264&nbsp;<em>m<sub>i<\/sub><\/em>&nbsp;\u2264 10<sup>9<\/sup>)\uff0c\u8868\u793a\u6bcf\u4e2a\u602a\u7269\u7684\u751f\u547d&#20540;\u3002<\/p>\n<p>\u3010\u8f93\u51fa\u6570\u636e\u3011<\/p>\n<p>\u6700\u5c0f\u7684\u7b26\u5408\u8981\u6c42\u7684p&#20540;\u3002<\/p>\n<p>\u3010\u6837\u4f8b\u8f93\u5165\u3011<\/p>\n<p>3 1<\/p>\n<p>1 4 5<\/p>\n<p>\u3010\u6837\u4f8b\u8f93\u51fa\u3011<\/p>\n<p>6<\/p>\n<p>\u3010\u6570\u636e\u8303\u56f4\u3011<\/p>\n<p>1 \u2264&nbsp;<em>n<\/em>&nbsp;\u2264 50000, 1 \u2264&nbsp;<em>k<\/em>&nbsp;\u2264100000\uff0c1 \u2264&nbsp;<em>m<sub>i<\/sub><\/em>&nbsp;\u226410<sup>9<\/sup><\/p>\n<p>30%\u7684\u6570\u636e\uff0cn \u2264 500<\/p>\n<p>\n<\/p>\n<p>\u8d2a\u5fc3&#43;\u4e8c\u5206 \u663e\u7136 \u6700\u53f3\u8fb9\u90a3\u4e2a\u5996\u602a\u4e00\u5b9a\u662f\u88ab\u8f70\u51fb\u81f4\u6b7b\u7684<\/p>\n<p>\n<\/p>\n<p><pre name=\"code\" class=\"delphi\">Program monster;\nconst\n   INF=1000000000;\nvar\n  n,k,i,j:longint;\n  m1,a:array[1..50000] of longint;\nprocedure sort(l,r:longint);\nvar\n   i,j,m,k2,kn:longint;\nbegin\n   if l=r then\n   begin\n      writeln(l);\n      close(input);\n      close(output);\n      halt;\n\n   end;\n\n   m:=(l+r) shr 1;\n   for i:=1 to n do a[i]:=m1[i];\n   k2:=k;\n   for i:=n downto 1 do\n      if a[i]&gt;0 then\n      begin\n         kn:=k2;\n         dec(k2,a[i] div m);\n         a[i]:=a[i] mod m;\n         if a[i]&gt;0 then\n         begin\n            dec(k2);\n            dec(a[i],m);\n         end;\n\n         if k2&lt;0 then sort(m+1,r);\n         kn:=kn-k2;\n         j:=i-1;\n         while (m-sqr(i-j)&gt;0) and (j&gt;=1) do\n         begin\n            if (kn*(a[j]-m+sqr(i-j))&lt;0) then a[j]:=0 else\n            dec(a[j],kn*(m-sqr(i-j)));\n            dec(j);\n         end;\n\n      end;\n   sort(l,m);\n\n\nend;\nbegin\n   assign(input,'monster.in');\n   assign(output,'monster.out');\n   reset(input);\n   rewrite(output);\n\n   read(n,k);\n   for i:=1 to n do\n   begin\n      read(m1[i]);\n      inc(m1[i]);\n   end;\n\n\n   sort(1,inf+1);\n\n\nend.\n<\/pre>\n<\/p>\n<p>\n<\/p>\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Monster \u3010\u9898\u76ee\u63cf\u8ff0\u3011 \u660e\u660e\u7684\u624b\u673a\u4e0a\u6709\u8fd9\u6837\u4e00\u4e2a\u6e38\u620f\uff0c\u6709\u4e00\u6392n\u4e2a\u602a\u7269\uff0c\u6bcf\u4e2a\u602a\u7269\u7684\u8840\u91cf\u662fmi\u3002\u73b0\u5728\u660e\u660e\u53ef\u4ee5\u5c04 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_coblocks_attr":"","_coblocks_dimensions":"","_coblocks_responsive_height":"","_coblocks_accordion_ie_support":"","footnotes":""},"categories":[3],"tags":[118],"class_list":["post-192","post","type-post","status-publish","format-standard","hentry","category-defaultcategory","tag-greedy"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Monster (\u8d2a\u5fc3\uff09 - nike0good<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/nike0good.com\/?p=192\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Monster (\u8d2a\u5fc3\uff09 - nike0good\" \/>\n<meta property=\"og:description\" content=\"Monster \u3010\u9898\u76ee\u63cf\u8ff0\u3011 \u660e\u660e\u7684\u624b\u673a\u4e0a\u6709\u8fd9\u6837\u4e00\u4e2a\u6e38\u620f\uff0c\u6709\u4e00\u6392n\u4e2a\u602a\u7269\uff0c\u6bcf\u4e2a\u602a\u7269\u7684\u8840\u91cf\u662fmi\u3002\u73b0\u5728\u660e\u660e\u53ef\u4ee5\u5c04 [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/nike0good.com\/?p=192\" \/>\n<meta property=\"og:site_name\" content=\"nike0good\" \/>\n<meta property=\"article:published_time\" content=\"2012-10-13T02:21:00+00:00\" \/>\n<meta name=\"author\" content=\"nike0good\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"nike0good\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/nike0good.com\\\/?p=192#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/nike0good.com\\\/?p=192\"},\"author\":{\"name\":\"nike0good\",\"@id\":\"https:\\\/\\\/nike0good.com\\\/#\\\/schema\\\/person\\\/4defa38da89de87e400861e73396baad\"},\"headline\":\"Monster (\u8d2a\u5fc3\uff09\",\"datePublished\":\"2012-10-13T02:21:00+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/nike0good.com\\\/?p=192\"},\"wordCount\":60,\"commentCount\":0,\"keywords\":[\"\u8d2a\u5fc3\"],\"articleSection\":[\"DefaultCategory\"],\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/nike0good.com\\\/?p=192#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/nike0good.com\\\/?p=192\",\"url\":\"https:\\\/\\\/nike0good.com\\\/?p=192\",\"name\":\"Monster (\u8d2a\u5fc3\uff09 - nike0good\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/nike0good.com\\\/#website\"},\"datePublished\":\"2012-10-13T02:21:00+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/nike0good.com\\\/#\\\/schema\\\/person\\\/4defa38da89de87e400861e73396baad\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/nike0good.com\\\/?p=192#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/nike0good.com\\\/?p=192\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/nike0good.com\\\/?p=192#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/nike0good.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Monster (\u8d2a\u5fc3\uff09\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/nike0good.com\\\/#website\",\"url\":\"https:\\\/\\\/nike0good.com\\\/\",\"name\":\"nike0good\",\"description\":\"\u6709\u6240\u4f5c\u4e3a\u662f\u4eba\u751f\u7684\u6700\u9ad8\u5883\u754c\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/nike0good.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/nike0good.com\\\/#\\\/schema\\\/person\\\/4defa38da89de87e400861e73396baad\",\"name\":\"nike0good\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/8e5fa08d5c367a1a6fb5ff13bb10ed5a331f981513256951290ae42322da6854?s=96&d=identicon&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/8e5fa08d5c367a1a6fb5ff13bb10ed5a331f981513256951290ae42322da6854?s=96&d=identicon&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/8e5fa08d5c367a1a6fb5ff13bb10ed5a331f981513256951290ae42322da6854?s=96&d=identicon&r=g\",\"caption\":\"nike0good\"},\"sameAs\":[\"https:\\\/\\\/nike0good.com\"],\"url\":\"https:\\\/\\\/nike0good.com\\\/?author=1\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Monster (\u8d2a\u5fc3\uff09 - nike0good","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/nike0good.com\/?p=192","og_locale":"zh_CN","og_type":"article","og_title":"Monster (\u8d2a\u5fc3\uff09 - nike0good","og_description":"Monster \u3010\u9898\u76ee\u63cf\u8ff0\u3011 \u660e\u660e\u7684\u624b\u673a\u4e0a\u6709\u8fd9\u6837\u4e00\u4e2a\u6e38\u620f\uff0c\u6709\u4e00\u6392n\u4e2a\u602a\u7269\uff0c\u6bcf\u4e2a\u602a\u7269\u7684\u8840\u91cf\u662fmi\u3002\u73b0\u5728\u660e\u660e\u53ef\u4ee5\u5c04 [&hellip;]","og_url":"https:\/\/nike0good.com\/?p=192","og_site_name":"nike0good","article_published_time":"2012-10-13T02:21:00+00:00","author":"nike0good","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"nike0good","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"1 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/nike0good.com\/?p=192#article","isPartOf":{"@id":"https:\/\/nike0good.com\/?p=192"},"author":{"name":"nike0good","@id":"https:\/\/nike0good.com\/#\/schema\/person\/4defa38da89de87e400861e73396baad"},"headline":"Monster (\u8d2a\u5fc3\uff09","datePublished":"2012-10-13T02:21:00+00:00","mainEntityOfPage":{"@id":"https:\/\/nike0good.com\/?p=192"},"wordCount":60,"commentCount":0,"keywords":["\u8d2a\u5fc3"],"articleSection":["DefaultCategory"],"inLanguage":"zh-Hans","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/nike0good.com\/?p=192#respond"]}]},{"@type":"WebPage","@id":"https:\/\/nike0good.com\/?p=192","url":"https:\/\/nike0good.com\/?p=192","name":"Monster (\u8d2a\u5fc3\uff09 - nike0good","isPartOf":{"@id":"https:\/\/nike0good.com\/#website"},"datePublished":"2012-10-13T02:21:00+00:00","author":{"@id":"https:\/\/nike0good.com\/#\/schema\/person\/4defa38da89de87e400861e73396baad"},"breadcrumb":{"@id":"https:\/\/nike0good.com\/?p=192#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/nike0good.com\/?p=192"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/nike0good.com\/?p=192#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/nike0good.com\/"},{"@type":"ListItem","position":2,"name":"Monster (\u8d2a\u5fc3\uff09"}]},{"@type":"WebSite","@id":"https:\/\/nike0good.com\/#website","url":"https:\/\/nike0good.com\/","name":"nike0good","description":"\u6709\u6240\u4f5c\u4e3a\u662f\u4eba\u751f\u7684\u6700\u9ad8\u5883\u754c","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/nike0good.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/nike0good.com\/#\/schema\/person\/4defa38da89de87e400861e73396baad","name":"nike0good","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/secure.gravatar.com\/avatar\/8e5fa08d5c367a1a6fb5ff13bb10ed5a331f981513256951290ae42322da6854?s=96&d=identicon&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/8e5fa08d5c367a1a6fb5ff13bb10ed5a331f981513256951290ae42322da6854?s=96&d=identicon&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/8e5fa08d5c367a1a6fb5ff13bb10ed5a331f981513256951290ae42322da6854?s=96&d=identicon&r=g","caption":"nike0good"},"sameAs":["https:\/\/nike0good.com"],"url":"https:\/\/nike0good.com\/?author=1"}]}},"_links":{"self":[{"href":"https:\/\/nike0good.com\/index.php?rest_route=\/wp\/v2\/posts\/192","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/nike0good.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/nike0good.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/nike0good.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/nike0good.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=192"}],"version-history":[{"count":0,"href":"https:\/\/nike0good.com\/index.php?rest_route=\/wp\/v2\/posts\/192\/revisions"}],"wp:attachment":[{"href":"https:\/\/nike0good.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=192"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/nike0good.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=192"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/nike0good.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=192"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}