{"id":363,"date":"2024-04-28T21:10:32","date_gmt":"2024-04-28T13:10:32","guid":{"rendered":"https:\/\/seanxd.com\/?p=363"},"modified":"2024-04-28T21:10:35","modified_gmt":"2024-04-28T13:10:35","slug":"zerojudge-d906","status":"publish","type":"post","link":"https:\/\/seanxd.com\/zh\/zerojudge-d906\/","title":{"rendered":"ZeroJudge D906: \u6392\u5ea7\u4f4d\u554f\u984c"},"content":{"rendered":"\n\n\n<p class=\"\">\u8c50\u6536\u570b\u5c0f\u662f\u4e00\u6240\u8ff7\u4f60\u5c0f\u5b78\uff0c\u4e00\u5e74\u7d1a\u53ea\u67096\u500b\u65b0\u751f\u5165\u5b78\uff0c\u6240\u4ee5\u8001\u5e2b\u5c07\u4ed6\u5011\u7684\u5ea7\u4f4d\u6392\u5728\u4e00\u500b2\u00d73\u7684\u683c\u5b50\u5716\u5f62\u4e2d\uff0c\u4e26\u4e14\u5c07\u5ea7\u4f4d\u7de8\u865f (\u5f9e 1 \u7de8\u5230 6)\uff0c\u5982\u4e0b\u5716\u7684\u7de8\u865f\u6cd5\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td class=\"has-text-align-center\" data-align=\"center\">1<\/td><td class=\"has-text-align-center\" data-align=\"center\">2<\/td><td class=\"has-text-align-center\" data-align=\"center\">3<\/td><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\">4<\/td><td class=\"has-text-align-center\" data-align=\"center\">5<\/td><td class=\"has-text-align-center\" data-align=\"center\">6<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p class=\"\">\u70ba\u4e86\u5b78\u751f\u8996\u529b\u7684\u8003\u91cf\uff0c\u8001\u5e2b\u6bcf\u500b\u6708\u7b2c1\u5929\u4e0a\u8ab2\u90fd\u6703\u63db\u4e00\u6b21\u5ea7\u4f4d\u3002\u5ea7\u4f4d\u6392\u6cd5\u6709\u4ee5\u4e0b\u898f\u5247\uff1a<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li class=\"\">\u55ae\u6708\u6578 (\u4f8b\u5982 1 \u6708\u30013 \u6708\u30015 \u6708 \u2026\u2026) \u4ee5\u5b78\u751f\u5b78\u865f\u70ba\u6e96\u6392\u5e8f\uff0c\u7531\u5c0f\u6392\u5230\u5927\u3002<\/li>\n\n\n\n<li class=\"\">\u96d9\u6708\u6578 (\u4f8b\u5982 2\u6708\u30014 \u6708\u30016 \u6708 \u2026\u2026) \u4ee5\u5b78\u751f\u8eab\u9ad8\u70ba\u6e96\u6392\u5e8f\uff0c\u7531\u77ee\u6392\u5230\u9ad8\uff0c\u5982\u679c\u8eab\u9ad8\u76f8\u540c\uff0c\u5b78\u865f\u865f\u78bc\u8f03\u5c0f\u7684\u540c\u5b78\u6392\u5728\u524d\u9762\u3002<strong>\u5b78\u751f\u5b78\u865f\u4e0d\u6703\u548c\u5225\u4eba\u91cd\u8986\uff0c\u4f46\u5b78\u751f\u8eab\u9ad8\u53ef\u80fd\u548c\u5225\u4eba\u76f8\u540c<\/strong>\u3002<\/li>\n\n\n\n<li class=\"\">\u8001\u5e2b\u4ee5\u62bd\u7c3d\u7684\u65b9\u5f0f\uff0c\u5f9e 1 \u5230 6 \u62bd\u51fa\u4e00\u500b\u6578\u5b57\uff0c\u6c7a\u5b9a\u6392\u5e8f\u6700\u524d\u9762\u7684\u540c\u5b78\u8981\u5750\u5e7e\u865f\u4f4d\u7f6e\uff0c\u63a5\u4e0b\u4f86\u6309\u7167\u6392\u5e8f\u9806\u5e8f\uff0c\u5750\u5728\u524d\u9762\u540c\u5b78\u7684\u5f8c\u4e00\u865f\u4f4d\u7f6e\uff0c\u800c\u5750\u5728 6 \u865f\u4f4d\u7f6e\u5f8c\u4e00\u865f\u7684\u540c\u5b78\u5fc5\u9808\u5750\u5230 1 \u865f\u3002<\/li>\n<\/ol>\n\n\n\n<p class=\"\">\u5728\u9019\u500b\u6392\u6cd5\u4e2d\uff0c\u7de8\u865f 2 \u865f\u7684\u5ea7\u4f4d\u6700\u9760\u8fd1\u8b1b\u53f0\u53ca\u8001\u5e2b\uff0c\u6240\u4ee5\u6bcf\u6b21\u6392\u5b8c\u4f4d\u7f6e\u5f8c\uff0c\u5927\u5bb6\u90fd\u8feb\u4e0d\u53ca\u5f85\u7684\u60f3\u77e5\u9053\u5750\u5728 2 \u865f\u4f4d\u7f6e\u7684\u540c\u5b78\u662f\u8ab0\uff1f\u4f8b\u5982\uff1a\u73ed\u4e0a\u540c\u5b78\u5728 11 \u6708\u63db\u5ea7\u4f4d\uff0c6 \u4f4d\u5b78\u751f\u4f9d\u5b78\u865f\u6392\u5e8f\u5f8c\uff0c\u5f97\u5230\u5b78\u751f\u59d3\u540d\u70ba A\u3001B\u3001C\u3001D\u3001E\u3001F\uff0c\u8001\u5e2b\u62bd\u7c3d\u62bd\u52305\u865f\uff0c\u5247\u6700\u5f8c\u7684\u5750\u6cd5\u5982\u4e0b\u5716\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td class=\"has-text-align-center\" data-align=\"center\">C<\/td><td class=\"has-text-align-center\" data-align=\"center\">D<\/td><td class=\"has-text-align-center\" data-align=\"center\">E<\/td><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\">F<\/td><td class=\"has-text-align-center\" data-align=\"center\">A<\/td><td class=\"has-text-align-center\" data-align=\"center\">B<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p class=\"\">\u6240\u4ee5\u5750\u57282\u865f\u4f4d\u7f6e\u7684\u662fD\u3002<\/p>\n\n\n\n<p class=\"\">\u73fe\u5728\u8acb\u4f60\u5beb\u7a0b\u5f0f\u5224\u65b7\u6392\u5b8c\u5ea7\u4f4d\u5f8c\uff0c<strong>\u5750\u5728\u7de8\u865f2\u865f\u4f4d\u7f6e\u7684\u540c\u5b78\u662f\u8ab0<\/strong>\uff1f<\/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\u6709\u4e00\u500b\u6b63\u6574\u6578 M (1 \u2264 M \u2264 12)\uff0cM \u4ee3\u8868\u63db\u5ea7\u4f4d\u6642\u7684\u6708\u4efd\u3002<br>\u7b2c\u4e8c\u884c\u6709\u4e00\u500b\u6b63\u6574\u6578 N (1 \u2264 N \u2264 6)\uff0cN \u70ba\u8001\u5e2b\u62bd\u7c3d\u62bd\u5230\u7684\u6578\u5b57\u3002<br>\u7b2c\u4e09\u884c\u5230\u7b2c\u516b\u884c\u70ba\u5b78\u751f\u7684\u8cc7\u6599\uff0c\u6bcf\u4e00\u884c\u6709\u4e09\u9805\u8cc7\u6599\uff0c\u4e2d\u9593\u4ee5\u7a7a\u767d\u9694\u958b\u3002\u7b2c\u4e00\u9805\u8cc7\u6599\u662f\u5b78\u751f\u59d3\u540d\uff0c\u4ee5\u4e00\u500b\u5927\u5beb\u82f1\u6587\u5b57\u6bcd (A\uff5eZ) \u4ee3\u8868\uff1b\u7b2c\u4e8c\u9805\u8cc7\u6599\u662f\u5b78\u751f\u5ea7\u865f\uff0c\u7531 3 \u4f4d\u6578\u5b57 (001\uff5e999) \u7d44\u6210\uff1b\u7b2c\u4e09\u9805\u8cc7\u6599\u662f\u5b78\u751f\u8eab\u9ad8\uff0c\u7531 3 \u4f4d\u6578\u5b57 (001\uff5e999) \u7d44\u6210\uff0c\u4ee3\u8868\u8eab\u9ad8\u5e7e\u516c\u5206\u3002<\/td><td>\u8acb\u8f38\u51fa 1 \u500b\u5b57\u6bcd\uff0c\u4ee3\u8868\u5750\u5728\u7de8\u865f 2 \u865f\u4f4d\u7f6e\u7684\u5b78\u751f\u59d3\u540d\u3002<\/td><\/tr><tr><td>11<br>5<br>A  101  147<br>B  102  120<br>C  103  108<br>D  104  130<br>E  105  140<br>F  106  120<\/td><td>D<\/td><\/tr><tr><td>4<br>2<br>L  102  127<br>K  101  120<br>M  103  138<br>B  104  130<br>A  106  110<br>S  105  120<\/td><td>A<\/td><\/tr><\/tbody><\/table><figcaption class=\"wp-element-caption\">ZeroJudge D906 \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 class=\"\">\u4f7f\u7528 <strong>Map \u4f86\u5b58\u6bcf\u500b\u5ea7\u865f\u6240\u5c0d\u61c9\u5230\u7684\u5b57\u5143<\/strong>\uff0c\u5982\u679c\u662f\u4f7f\u7528\u5ea7\u865f\u6392\u5e8f\u5247\u5c07\u5ea7\u865f\u653e\u5230\u9663\u5217\u4e2d\u5f8c\u9032\u884c\u6392\u5e8f\uff0c\u5982\u679c\u662f<strong>\u7528\u8eab\u9ad8\u6392\u5e8f\u7684\u8a71\u5247\u4f7f\u7528 Pair \u4f86\u6392\u5e8f\uff0c\u8eab\u9ad8\u653e\u524d\u9762\uff0c\u5ea7\u865f\u653e\u5f8c\u9762\u3002<\/strong>\u6700\u5f8c\u8f38\u51fa\u7b2c\u4e8c\u500b\u5ea7\u4f4d\u4e0a\u7684\u5b78\u751f\u59d3\u540d\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=d906\" target=\"_blank\" rel=\"noreferrer noopener\">ZeroJudge D906: \u6392\u5ea7\u4f4d\u554f\u984c<\/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;map&gt;\n#include &lt;algorithm&gt;\nusing namespace std;\n\npair&lt;int, int&gt; rtn (int a, int b)\n{\n    pair&lt;int, int&gt; tmp;\n    tmp.first = a;\n    tmp.second = b;\n    return tmp;\n}\n\nint main() {\n    cin.sync_with_stdio(0);\n    cin.tie(0);\n    map&lt;int, int&gt;index;\n    index[1] = 1;\n    index[2] = 0;\n    index[3] = 5;\n    index[4] = 4;\n    index[5] = 3;\n    index[6] = 2;\n    int M, N;\n    cin &gt;&gt; M &gt;&gt; N;\n    if (M % 2 == 1)\n    {\n        vector&lt;int&gt;num;\n        map&lt;int, char&gt;MAP;\n        for (int i = 0; i&lt;6; i++)\n        {\n            char ch;\n            int ID, height;\n            cin &gt;&gt; ch &gt;&gt; ID &gt;&gt; height;\n            MAP[ID] = ch;\n            num.push_back(ID);\n        }\n        sort(num.begin(), num.end());\n        cout &lt;&lt; MAP[num[index[N]]] &lt;&lt; &quot;\\n&quot;;\n    }\n    else\n    {\n        vector&lt;pair&lt;int, int&gt;&gt;num;\n        map&lt;pair&lt;int, int&gt;, char&gt;MAP;\n        for (int i = 0; i&lt;6; i++)\n        {\n            char ch;\n            int ID, height;\n            cin &gt;&gt; ch &gt;&gt; ID &gt;&gt; height;\n            MAP[rtn(height, ID)] = ch;\n            num.push_back(rtn(height, ID));\n        }\n        sort(num.begin(), num.end());\n        cout &lt;&lt; MAP[num[index[N]]] &lt;&lt; &quot;\\n&quot;;\n    }\n}\n\n\/\/ZeroJudge D906\n\/\/Dr. SeanXD<\/code><\/pre><\/div>\n","protected":false},"excerpt":{"rendered":"<p>\u8c50\u6536\u570b\u5c0f\u662f\u4e00\u6240\u8ff7\u4f60\u5c0f\u5b78\uff0c\u4e00\u5e74\u7d1a\u53ea\u67096\u500b\u65b0\u751f\u5165\u5b78\uff0c\u6240\u4ee5\u8001\u5e2b\u5c07\u4ed6\u5011\u7684\u5ea7\u4f4d\u6392\u5728\u4e00\u500b2\u00d73\u7684\u683c\u5b50\u5716\u5f62\u4e2d\uff0c\u4e26\u4e14\u5c07\u5ea7\u4f4d\u7de8\u865f [&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":[29],"tags":[14,23,20,19,13],"class_list":["post-363","post","type-post","status-publish","format-standard","hentry","category-zerojudge-","tag-map","tag-pair","tag-20","tag-19","tag-13"],"blocksy_meta":[],"_links":{"self":[{"href":"https:\/\/seanxd.com\/zh\/wp-json\/wp\/v2\/posts\/363","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=363"}],"version-history":[{"count":2,"href":"https:\/\/seanxd.com\/zh\/wp-json\/wp\/v2\/posts\/363\/revisions"}],"predecessor-version":[{"id":365,"href":"https:\/\/seanxd.com\/zh\/wp-json\/wp\/v2\/posts\/363\/revisions\/365"}],"wp:attachment":[{"href":"https:\/\/seanxd.com\/zh\/wp-json\/wp\/v2\/media?parent=363"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/seanxd.com\/zh\/wp-json\/wp\/v2\/categories?post=363"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/seanxd.com\/zh\/wp-json\/wp\/v2\/tags?post=363"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}