{"id":305,"date":"2024-04-27T17:44:53","date_gmt":"2024-04-27T09:44:53","guid":{"rendered":"https:\/\/seanxd.com\/?p=305"},"modified":"2024-04-27T17:44:55","modified_gmt":"2024-04-27T09:44:55","slug":"zerojudge-f731","status":"publish","type":"post","link":"https:\/\/seanxd.com\/zh\/zerojudge-f731\/","title":{"rendered":"ZeroJudge F731: \u8001\u9f20\u7684\u76f4\u64ad\u9593"},"content":{"rendered":"\n\n\n<p class=\"\">\u8001\u9f20\u5e0c\u671b\u80fd\u5920\u77e5\u9053<strong>\u76f4\u64ad\u671f\u9593\u6700\u9ad8\u540c\u6642\u6709\u5e7e\u500b\u4eba\u5728\u7dda\u4e0a\u89c0\u770b<\/strong>\uff0c\u65bc\u662f\u4ed6\u627e\u4e86\u6703\u5beb\u7a0b\u5f0f\u7684\u4f60\u5e6b\u5fd9\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 nfd-wb-animate nfd-wb-fade-in-bottom-short\"><table class=\"has-fixed-layout\"><thead><tr><th>\u7bc4\u4f8b\u8f38\u5165<\/th><th>\u7bc4\u4f8b\u8f38\u51fa<\/th><\/tr><\/thead><tbody><tr><td>\u7b2c\u4e00\u884c N \u4ee3\u8868\u63a5\u4e0b\u4f86\u6709 N \u500b\u4eba\u3002<br>\u63a5\u4e0b\u4f86\u6bcf\u884c\u6709\u5169\u500b\u6574\u6578 A<sub>i<\/sub> \u548c B<sub>i<\/sub> \u5206\u5225\u4ee3\u8868\u9019\u500b\u4eba\u9032\u5165\u548c\u96e2\u958b\u76f4\u64ad\u9593\u7684\u6642\u9593\u9ede\u3002<br><strong>\u6bcf\u500b\u6642\u9593\u9ede\u53ea\u6703\u6709\u4e00\u500b\u4eba\u9032\u5165\/\u96e2\u958b<\/strong><\/td><td>\u8acb\u4f60\u8f38\u51fa\u76f4\u64ad\u671f\u9593\u6700\u9ad8\u540c\u6642\u6709\u5e7e\u500b\u4eba\u5728\u7dda\u4e0a\u89c0\u770b\u3002<\/td><\/tr><tr><td>3<br>1  3<br>5  6<br>2  4<\/td><td>2<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">\u89e3\u984c\u601d\u8def<\/h2>\n\n\n\n<p class=\"\">\u5c07<strong>\u300c\u9032\u5165\u6642\u9593\u300d\u8ddf\u300c\u51fa\u4f86\u6642\u9593\u300d\u5b58\u5728\u4e0d\u540c\u7684\u9663\u5217\u4e2d\u4e26\u300c\u6392\u5e8f\u300d<\/strong>\u3002<\/p>\n\n\n\n<p class=\"\"><strong>\u8dd1\u300c\u9032\u5165\u6642\u9593\u300d\u7684 For\u8ff4\u5708<\/strong>\uff0c\u6bcf\u6b21\u4eba\u6578+1\uff0c\u7136\u5f8c<strong>\u88e1\u9762\u518d\u8dd1\u4e00\u500b\u300c\u51fa\u4f86\u6642\u9593\u300d\u7684 For\u8ff4\u5708<\/strong>\uff0c\u9700\u8981\u6709\u4e00\u500b <strong>Start<\/strong> \u7684\u8b8a\u6578 (\u9810\u8a2d\u70ba 0)\uff0c\u5f9e Start \u9019\u500b\u4f4d\u7f6e\u958b\u59cb\u5224\u65b7\uff0c\u5982\u679c\u51fa\u4f86\u7684\u6642\u9593\u5c0f\u65bc\u73fe\u5728\u7684\u9032\u4f86\u6642\u9593\uff0c\u90a3\u4eba\u6578\u5c31-1\uff0c\u76f4\u5230\u8dd1\u5230\u51fa\u4f86\u6642\u9593\u5927\u65bc\u9032\u4f86\u6642\u9593\u4e86\u624d\u628a\u51fa\u4f86\u6642\u9593\u7684 <strong>For\u8ff4\u5708 Break<\/strong> \u6389\uff0c\u7136\u5f8c\u5728\u9019\u908a\u518d\u5224\u65b7\u76ee\u524d\u6709\u5e7e\u500b\u4eba\u7684\u6700\u5927\u503c\u3002\u6700\u5f8c\u8f38\u51fa\u5f97\u5230\u7684\u6700\u5927\u503c\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=f731\" target=\"_blank\" rel=\"noreferrer noopener\">ZeroJudge F731: \u8001\u9f20\u7684\u76f4\u64ad\u9593<\/a><\/h3>\n\n\n\n<div class=\"hcb_wrap nfd-wb-animate nfd-wb-reveal-right nfd-delay-50\"><pre class=\"prism line-numbers lang-cpp\" data-lang=\"C++\"><code>#include &lt;iostream&gt;\n#include &lt;vector&gt;\n#include &lt;algorithm&gt;\nusing namespace std;\n\nint main() {\n    cin.sync_with_stdio(0);\n    cin.tie(0);\n    int N;\n    cin &gt;&gt; N;\n    vector&lt;int&gt;in;\n    vector&lt;int&gt;out;\n    for (int i = 0; i&lt;N; i++)\n    {\n        int a, b;\n        cin &gt;&gt; a &gt;&gt; b;\n        in.push_back(a);\n        out.push_back(b);\n    }\n    sort(in.begin(), in.end());\n    sort(out.begin(), out.end());\n    int people = 0, start = 0, max = -999;\n    for (int i = 0; i&lt;N; i++)\n    {\n        people++;\n        for (int j = start; j&lt;N; j++)\n        {\n            if (out[j] &gt; in[i])\n            {\n                start = j;\n                break;\n            }\n            people--;\n        }\n        if (people &gt; max) max = people;\n    }\n    cout &lt;&lt; max &lt;&lt; &quot;\\n&quot;;\n}\n\n\/\/ZeroJudge F731\n\/\/Dr. SeanXD<\/code><\/pre><\/div>\n","protected":false},"excerpt":{"rendered":"<p>\u8001\u9f20\u5e0c\u671b\u80fd\u5920\u77e5\u9053\u76f4\u64ad\u671f\u9593\u6700\u9ad8\u540c\u6642\u6709\u5e7e\u500b\u4eba\u5728\u7dda\u4e0a\u89c0\u770b\uff0c\u65bc\u662f\u4ed6\u627e\u4e86\u6703\u5beb\u7a0b\u5f0f\u7684\u4f60\u5e6b\u5fd9\u3002 \u7bc4\u4f8b\u6e2c\u8cc7 \u7bc4\u4f8b\u8f38\u5165 \u7bc4\u4f8b\u8f38\u51fa [&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":[6],"tags":[20,8,19,9],"class_list":["post-305","post","type-post","status-publish","format-standard","hentry","category-6","tag-20","tag-8","tag-19","tag-9"],"blocksy_meta":[],"_links":{"self":[{"href":"https:\/\/seanxd.com\/zh\/wp-json\/wp\/v2\/posts\/305","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=305"}],"version-history":[{"count":1,"href":"https:\/\/seanxd.com\/zh\/wp-json\/wp\/v2\/posts\/305\/revisions"}],"predecessor-version":[{"id":306,"href":"https:\/\/seanxd.com\/zh\/wp-json\/wp\/v2\/posts\/305\/revisions\/306"}],"wp:attachment":[{"href":"https:\/\/seanxd.com\/zh\/wp-json\/wp\/v2\/media?parent=305"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/seanxd.com\/zh\/wp-json\/wp\/v2\/categories?post=305"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/seanxd.com\/zh\/wp-json\/wp\/v2\/tags?post=305"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}