{"id":1022,"date":"2024-08-03T09:00:00","date_gmt":"2024-08-03T01:00:00","guid":{"rendered":"https:\/\/seanxd.com\/?p=1022"},"modified":"2024-08-03T10:20:51","modified_gmt":"2024-08-03T02:20:51","slug":"zerojudge-h660","status":"publish","type":"post","link":"https:\/\/seanxd.com\/zh\/zerojudge-h660\/","title":{"rendered":"ZeroJudge H660: \u8eb2\u907f\u7403 (DodgeBall)"},"content":{"rendered":"\n\n\n<p>\u963f\u8302\u9019\u9031\u5047\u65e5\u8981\u53bb\u5b78\u6821\u548c\u540c\u5b78\u4e00\u8d77\u7df4\u7fd2\u8eb2\u907f\u7403\u6bd4\u8cfd\u3002\u8eb2\u907f\u7403\u7684\u76ee\u6a19\u70ba\u64f2\u7403\u653b\u64ca\u5c0d\u65b9\u5167\u5834\u7403\u54e1\uff0c\u5728\u5167\u5834\u7684\u7403\u54e1\u5728\u5c0d\u65b9\u7684\u7403\u4f86\u6642\u53ef\u4ee5\u9078\u64c7\u8eb2\u958b\u6216\u662f\u63a5\u4f4f\u7403\uff0c\u5982\u679c\u64ca\u4e2d\u8eab\u9ad4\u4e14\u6c92\u4eba\u63a5\u4f4f\uff0c\u5247\u8a72\u540d\u7403\u54e1\u9700\u79fb\u81f3\u5916\u5834\u7b49\u5f85\u3002<\/p>\n\n\n\n<p>\u963f\u8302\u5728\u7df4\u7fd2\u8eb2\u907f\u7403\u6642\u7d66\u81ea\u5df1\u8a02\u4e86\u4e00\u500b\u7b56\u7565\uff1a<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>\u539f\u5730\u4e0d\u52d5\uff1a\u82e5\u843d\u7403\u4f4d\u7f6e\u4e0d\u5728\u963f\u8302\u53ef\u63a5\u7403\u7684\u7bc4\u570d\u5167\u5247\u4ed6\u4e0d\u6703\u79fb\u52d5\u3002<\/li>\n\n\n\n<li>\u63a5\u7403\uff1a\u82e5\u843d\u7403\u4f4d\u7f6e\u5728\u53ef\u63a5\u7403\u7bc4\u570d\u4e14\u7403\u901f\u5920\u6162\uff0c\u963f\u8302\u6703\u79fb\u52d5\u5230\u7403\u7684\u4f4d\u7f6e\u4e14\u63a5\u4f4f\u7403\u3002<\/li>\n\n\n\n<li>\u9583\u8eb2\uff1a\u82e5\u843d\u7403\u4f4d\u7f6e\u5728\u53ef\u63a5\u7403\u7bc4\u570d\u4f46\u7403\u901f\u904e\u5feb\uff0c\u5247\u963f\u8302\u6703\u9078\u64c7\u5411\u7403\u7684\u53cd\u65b9\u5411 (\u7403\u5728\u963f\u8302\u5de6\u908a\uff0c\u963f\u8302\u5c31\u5f80\u53f3\u908a\u79fb\u52d5) \u79fb\u52d5 15 \u55ae\u4f4d\u8ddd\u96e2\uff1b<strong>\u82e5\u843d\u7403\u4f4d\u7f6e\u8207\u963f\u8302\u4f4d\u7f6e\u525b\u597d\u76f8\u540c\uff0c\u4ed6\u6703\u5f80\u5de6\u908a\u65b9\u5411\u9583\u8eb2<\/strong>\u3002<\/li>\n<\/ol>\n\n\n\n<p>\u5047\u8a2d\u963f\u8302\u5728\u4f4d\u7f6e 100\uff0c\u63a5\u7403\u7684\u5de6\u53f3\u5ef6\u4f38\u9577\u5ea6\u70ba 10 (\u5373 [100\u201310, 100+100] = [90, 110] \u70ba\u63a5\u7403\u7bc4\u570d)\uff0c\u53ef\u63a5\u7403\u7684\u7403\u901f\u4e0a\u9650\u70ba 10\u3002\u82e5\u843d\u7403\u4f4d\u7f6e\u70ba 99 \u4e14\u7403\u901f\u70ba 5\uff0c\u5247\u963f\u8302\u6703\u9078\u64c7\u63a5\u4f4f\u7403\u4e14\u7ad9\u5728\u4f4d\u7f6e 99\uff1b\u4f46\u82e5\u843d\u7403\u4f4d\u7f6e\u70ba 99 \u4e14\u7403\u901f\u70ba 20\uff0c\u5247\u963f\u8302\u6703\u9583\u8eb2\u5230 115 (100 + 15) \u7684\u4f4d\u7f6e\u3002<\/p>\n\n\n\n<p>\u8acb\u4f60\u5229\u7528\u7a0b\u5f0f\u8a08\u7b97\u963f\u8302\u5728\u7d93\u904e\u4e00\u9023\u4e32\u8eb2\u907f\u7403\u7df4\u7fd2\u5f8c\u7ad9\u8457\u7684\u4f4d\u7f6e\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u7bc4\u4f8b\u6e2c\u8cc7<\/h2>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>\u7bc4\u4f8b\u8f38\u5165<\/th><th>\u7bc4\u4f8b\u8f38\u51fa<\/th><\/tr><\/thead><tbody><tr><td>\u8f38\u5165\u7b2c\u4e00\u5217\u6709\u5169\u500b\u6574\u6578 X\u3001R\u3001V (0 \u2264 X \u2264 1000\uff0c0 \u2264 R \u2264 500\uff0c1 \u2264 V \u2264 50)\uff0c\u5206\u5225\u8868\u793a\u963f\u8302\u7684\u4f4d\u7f6e\u3001\u63a5\u7403\u7684\u5de6\u53f3\u5ef6\u4f38\u9577\u5ea6\u548c\u53ef\u63a5\u7403\u7684\u7403\u901f\u4e0a\u9650\u3002<br>\u7b2c\u4e8c\u5217\u6709\u4e00\u500b\u6574\u6578 N (1 \u2264 N \u2264 100) \u8868\u793a\u7df4\u7fd2\u7684\u6b21\u6578\uff0c\u4e4b\u5f8c\u6709 N \u5217\uff0c\u6bcf\u4e00\u5217\u6709\u5169\u500b\u6574\u6578 P \u548c S (0 \u2264 P \u2264 1000\uff0c0 \u2264 S \u2264 50) \u8868\u793a\u6bcf\u4e00\u6b21\u7684\u843d\u7403\u4f4d\u7f6e\u548c\u7403\u901f\u3002\u540c\u4e00\u5217\u4efb\u5169\u500b\u6574\u6578\u9593\u4ee5\u7a7a\u767d\u9593\u9694\u3002<\/td><td>\u8f38\u51fa\u4e00\u500b\u6574\u6578\u8868\u793a\u6700\u5f8c\u963f\u8302\u6240\u5728\u4f4d\u7f6e\u3002<\/td><\/tr><tr><td>100 10 10<br>3<br>99 5<br>97 3<br>88 4<\/td><td>88<\/td><\/tr><tr><td>500 80 15<br>5<br>400 10<br>420 5<br>300 20<br>395 25<br>435 18<\/td><td>420<\/td><\/tr><tr><td>20 10 5<br>3<br>30 8<br>15 2<br>20 10<\/td><td>0<\/td><\/tr><\/tbody><\/table><figcaption class=\"wp-element-caption\">ZeroJudge H660 \u7bc4\u4f8b\u6e2c\u8cc7<\/figcaption><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">\u89e3\u984c\u601d\u8def<\/h2>\n\n\n\n<p>\u6bcf\u6b21\u7d00\u9304\u65b0\u7684 P \u548c S \u6642\uff0c\u5148\u5ba3\u544a\u5169\u500b\u8b8a\u6578 left \u548c right\uff0c\u5206\u5225\u4ee3\u8868\u76ee\u524d\u53ef\u4ee5\u63a5\u7403\u7684\u5de6\u53f3\u908a\u754c\u3002<\/p>\n\n\n\n<p>\u5982\u679c\u4eca\u5929 P \u6c92\u6709\u5728 left \u548c right \u7684\u7bc4\u570d\u5167\uff0c\u5247\u4e0d\u9700\u8981\u505a\u4efb\u4f55\u52d5\u4f5c\u3002<\/p>\n\n\n\n<p>\u5982\u679c\u4eca\u5929 P \u5728\u7bc4\u570d\u5167\uff0c\u5247\u8981\u5148\u5224\u65b7\u7403\u901f S \u662f\u5426\u8d85\u904e\u53ef\u4ee5\u627f\u53d7\u7684\u7403\u901f V\u3002\u5982\u679c S &lt;= V\uff0c\u4ee3\u8868\u53ef\u4ee5\u63a5\u7403\uff0c\u6240\u4ee5\u5c07 X \u8a2d\u5b9a\u6210 P\u3002\u5982\u679c\u7403\u901f\u904e\u5feb\uff0c\u5247\u8981\u5224\u65b7\u8981\u5f80\u54ea\u908a\u9583\u8eb2\uff0c\u5982\u679c\u4eca\u5929 P &gt;= X\uff0c\u4ee3\u8868\u7403\u5728\u53f3\u908a\uff0c\u6240\u4ee5\u8981\u5f80\u5de6\u9583 X -= 15\uff0c\u9019\u908a\u4f7f\u7528 &gt;= \u662f\u56e0\u70ba\u984c\u76ee\u6709\u8aaa\u5982\u679c P == X \u8981\u5f80\u5de6\u9583\uff0c\u5982\u679c\u4eca\u5929\u7403\u5728\u5de6\u908a\u5c31\u662f\u5f80\u53f3\u9583 X += 15\u3002<\/p>\n\n\n\n<p>\u6700\u5f8c\u8f38\u51fa X \u5373\u53ef\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\u7bc4\u4f8b\u7a0b\u5f0f\u78bc\uff0d<a href=\"https:\/\/zerojudge.tw\/ShowProblem?problemid=h660\" target=\"_blank\" rel=\"noreferrer noopener\">ZeroJudge H660: \u8eb2\u907f\u7403 (DodgeBall)<\/a><\/h3>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-cpp\" data-lang=\"C++\"><code>#include &lt;iostream&gt;\nusing namespace std;\n\nint main() {\n    cin.sync_with_stdio(0);\n    cin.tie(0);\n    int X, R, V, N;\n    cin &gt;&gt; X &gt;&gt; R &gt;&gt; V &gt;&gt; N;\n    for (int i = 0; i&lt;N; i++) {\n        int P, S, left = X - R, right = X + R;\n        cin &gt;&gt; P &gt;&gt; S;\n        if (P &lt; left || P &gt; right) continue;\n        if (S &lt;= V) {\n            X = P;\n            continue;\n        }\n        if (P &gt;= X) X -= 15;\n        else X += 15;\n    }\n    cout &lt;&lt; X &lt;&lt; &quot;\\n&quot;;\n}\n\n\/\/ZeroJudge H660\n\/\/Dr. SeanXD<\/code><\/pre><\/div>\n","protected":false},"excerpt":{"rendered":"<p>\u963f\u8302\u9019\u9031\u5047\u65e5\u8981\u53bb\u5b78\u6821\u548c\u540c\u5b78\u4e00\u8d77\u7df4\u7fd2\u8eb2\u907f\u7403\u6bd4\u8cfd\u3002\u8eb2\u907f\u7403\u7684\u76ee\u6a19\u70ba\u64f2\u7403\u653b\u64ca\u5c0d\u65b9\u5167\u5834\u7403\u54e1\uff0c\u5728\u5167\u5834\u7684\u7403\u54e1\u5728\u5c0d\u65b9\u7684\u7403\u4f86\u6642\u53ef [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"nf_dc_page":"","footnotes":""},"categories":[25],"tags":[8,9],"class_list":["post-1022","post","type-post","status-publish","format-standard","hentry","category-ioi-apcs","tag-8","tag-9"],"blocksy_meta":[],"_links":{"self":[{"href":"https:\/\/seanxd.com\/zh\/wp-json\/wp\/v2\/posts\/1022","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/seanxd.com\/zh\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/seanxd.com\/zh\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/seanxd.com\/zh\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/seanxd.com\/zh\/wp-json\/wp\/v2\/comments?post=1022"}],"version-history":[{"count":4,"href":"https:\/\/seanxd.com\/zh\/wp-json\/wp\/v2\/posts\/1022\/revisions"}],"predecessor-version":[{"id":1160,"href":"https:\/\/seanxd.com\/zh\/wp-json\/wp\/v2\/posts\/1022\/revisions\/1160"}],"wp:attachment":[{"href":"https:\/\/seanxd.com\/zh\/wp-json\/wp\/v2\/media?parent=1022"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/seanxd.com\/zh\/wp-json\/wp\/v2\/categories?post=1022"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/seanxd.com\/zh\/wp-json\/wp\/v2\/tags?post=1022"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}