{"id":18,"date":"2016-04-28T21:13:15","date_gmt":"2016-04-28T13:13:15","guid":{"rendered":"http:\/\/tyswly.com\/?p=18"},"modified":"2016-04-28T21:13:15","modified_gmt":"2016-04-28T13:13:15","slug":"noip2015%e8%b7%b3%e7%9f%b3%e5%a4%b4","status":"publish","type":"post","link":"https:\/\/tys.fun\/?p=18","title":{"rendered":"[NOIP2015]\u8df3\u77f3\u5934"},"content":{"rendered":"<p style=\"text-align: center;\">\u539f\u9898\u8bf7\u89c1<a href=\"http:\/\/syzoj.com\/problem\/95\">SYZOJ<\/a><\/p>\n<p style=\"text-align: left;\">\u00a0 \u00a0 \u00a0 \u00a0 \u5173\u4e8e\u8fd9\u9053\u9898\uff0c\u5f53\u65f6\u8003\u573a\u4e0a\u5199\u7684\u65f6\u5019\uff0c\u89c9\u5f97\u8d2a\u5fc3\u5c31\u662f\u6b63\u89e3\u3002\u7136\u800c\u4e00\u4e0b\u8003\u573a\uff0c\u5b66\u957f\u544a\u8bc9\u6211\u8bf4\u662f\u4e8c\u5206\uff0c\u5f53\u65f6\u7684\u6211too young too naive, \u8fd8\u4e0d\u77e5\u9053\u4e8c\u5206\u641c\u7d22\u662f\u4ec0\u4e48\uff0c\u5982\u4eca\u524d\u6765\u8865\u6863\u3002<\/p>\n<p style=\"text-align: left;\">\n<pre class=\"lang:c++ decode:true \">#include &lt;iostream&gt;\n#include &lt;cstdio&gt;\n#include &lt;queue&gt;\n#include &lt;algorithm&gt;\n#define LL long long\nusing namespace std;\nint l, m, n;\nLL sum, le=0, ri, mid;\nint d[50005];\ninline int get_num()\n{\n\tint ans=0;\n\tchar tmp;\n\ttmp=getchar();\n\twhile(tmp&gt;'9'||tmp&lt;'0')\ttmp=getchar();\n\twhile(tmp&gt;='0'&amp;&amp;tmp&lt;='9')\n\t{\n\t\tans=ans*10+tmp-48;\n\t\ttmp=getchar();\n\t}\n\treturn ans;\n}\ninline int check(int a);\nint main()\n{\n\tcin&gt;&gt;l&gt;&gt;n&gt;&gt;m;\n\tfor(int i=1;i&lt;=n;i++)\n\t{\n\t\td[i]=get_num();\n\t\t\/\/d[i]=d[i]-sum;\n\t\t\/\/sum+=d[i];\n\t}\n\tn++;\n\td[n]=l;\n\tri=l;\n\tint ans;\n\twhile(le&lt;=ri)\n\t{\n\t\tmid=((ri-le)&gt;&gt;1)+le;\n\t\tif(check(mid)&lt;=m)\n\t\t{\n\t\t\tle=mid+1;\n\t\t\tans=mid;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tri=mid-1;\n\t\t}\n\t}\n\tcout&lt;&lt;ans&lt;&lt;\"\\n\";\n}\ninline int check(int a)\n{\n\tLL sum=0;\n\tint tmp=0;\n\tfor(int i=1;i&lt;=n;i++)\n\t{\n\t\tif(d[i]-d[tmp]&lt;a)\n\t\t\tsum++;\n\t\telse\n\t\t\ttmp=i;\n\t}\n\treturn sum;\n}<\/pre>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u539f\u9898\u8bf7\u89c1SYZOJ \u00a0 \u00a0 \u00a0 \u00a0 \u5173\u4e8e\u8fd9\u9053\u9898\uff0c\u5f53\u65f6\u8003\u573a\u4e0a\u5199\u7684\u65f6\u5019\uff0c\u89c9\u5f97\u8d2a\u5fc3\u5c31\u662f\u6b63\u89e3\u3002\u7136\u800c\u4e00\u4e0b\u8003\u573a\uff0c\u5b66\u957f\u544a\u8bc9\u6211 &hellip; <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[4],"tags":[],"class_list":["post-18","post","type-post","status-publish","format-standard","hentry","category-report"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/tys.fun\/index.php?rest_route=\/wp\/v2\/posts\/18","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/tys.fun\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/tys.fun\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/tys.fun\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/tys.fun\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=18"}],"version-history":[{"count":0,"href":"https:\/\/tys.fun\/index.php?rest_route=\/wp\/v2\/posts\/18\/revisions"}],"wp:attachment":[{"href":"https:\/\/tys.fun\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=18"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/tys.fun\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=18"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/tys.fun\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=18"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}