{"id":625,"date":"2024-07-01T09:00:00","date_gmt":"2024-07-01T01:00:00","guid":{"rendered":"https:\/\/seanxd.com\/?p=625"},"modified":"2024-05-28T18:58:31","modified_gmt":"2024-05-28T10:58:31","slug":"zerojudge-k514","status":"publish","type":"post","link":"https:\/\/seanxd.com\/zh\/zerojudge-k514\/","title":{"rendered":"ZeroJudge K514: \u89e3\u85e5 (Medicine)"},"content":{"rendered":"\n\n\n<p class=\"\">\u5c0f\u96ea\u60a3\u4e86\u4e00\u7a2e\u5947\u602a\u7684\u50b3\u67d3\u75c5\uff0c\u8eab\u4e0a\u9577\u6eff\u4e86\u75b9\u5b50\uff0c\u5168\u8eab\u53c8\u75db\u53c8\u7662\u7684\uff0c\u5c31\u9023\u91ab\u751f\u4e5f\u67e5\u4e0d\u51fa\u75c5\u60c5\u3002\u6b63\u7576\u82e6\u60f1\u4e4b\u6642\uff0c\u6709\u4e00\u4f4d\u795e\u79d8\u5a46\u5a46\u7a81\u7136\u51fa\u73fe\uff0c\u8aaa\u4ed6\u6709\u4e00\u9053\u7956\u50b3\u7684\u795e\u5947\u89e3\u85e5\u53ef\u4ee5\u6cbb\u597d\u5c0f\u96ea\u7684\u75c5\uff0c\u4f46\u662f\u9019\u500b\u89e3\u85e5\u9700\u8981\u6709\u56db\u7a2e\u6750\u6599 A\u3001B\u3001C\u3001\u548c D\uff0c\u4e14\u5fc5\u9808\u8981\u4ee5\u7279\u6b8a\u7684\u6bd4\u4f8b\u624d\u80fd\u88fd\u4f5c\u3002<br>\u6bcf\u7a2e\u6750\u6599\u5a46\u5a46\u90fd\u5206\u88c5\u6210\u4e0d\u540c\u5927\u5c0f\u4efd\u91cf\u7684 N \u5c0f\u5305\uff0c\u4e14\u6bcf\u5c0f\u5305\u90fd\u4e0d\u80fd\u518d\u5207\u5206\u6216\u5408\u4f75\u3002\u4ee5\u4e0b\u8868\u70ba\u4f8b\uff0c\u6bcf\u7a2e\u6750\u6599\u90fd\u5206\u6210\u4e94\u5c0f\u5305\uff0c\u6750\u6599 A \u4e94\u5c0f\u5305\u7684\u4efd\u91cf\u70ba 2\u30019\u30015\u30018\u3001\u548c 1\uff0c\u6750\u6599B \u4e94\u5c0f\u5305\u7684\u4efd\u91cf\u70ba 8\u30013\u30011\u30014\u3001\u548c 5\uff0c\u4ee5\u6b64\u985e\u63a8\u3002\u82e5\u89e3\u85e5\u7684\u6700\u4f73\u6bd4\u4f8b\u70ba 1\uff1a2\uff1a1\uff1a3\uff0c\u6211\u5011\u53ef\u5c0d A \u6750\u6599\u62ff\u53d6\u7b2c\u4e00\u5c0f\u5305\u3001B \u6750\u6599\u62ff\u53d6\u7b2c\u56db\u5c0f\u5305\u3001C \u6750\u6599\u62ff\u53d6\u7b2c\u56db\u5c0f\u5305\u3001D \u6750\u6599\u62ff\u53d6\u7b2c\u4e09\u5c0f\u5305\uff0c\u4ee5\u6309\u7167\u6b63\u78ba\u6bd4\u4f8b\u88fd\u6210\u89e3\u85e5\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-full\"><img decoding=\"async\" width=\"458\" height=\"206\" loading=\"lazy\" src=\"https:\/\/seanxd.com\/wp-content\/uploads\/2024\/05\/\u622a\u5716-2024-05-28-\u4e0b\u53486.52.21.png\" alt=\"ZeroJudge K514 \u984c\u76ee\u89e3\u91cb\u7528\u5716\" class=\"wp-image-626\" srcset=\"https:\/\/seanxd.com\/wp-content\/uploads\/2024\/05\/\u622a\u5716-2024-05-28-\u4e0b\u53486.52.21.png 458w, https:\/\/seanxd.com\/wp-content\/uploads\/2024\/05\/\u622a\u5716-2024-05-28-\u4e0b\u53486.52.21-300x135.png 300w\" sizes=\"auto, (max-width: 458px) 100vw, 458px\" \/><\/figure>\n\n\n\n<p class=\"\">\u8acb\u4f60\u64b0\u5beb\u4e00\u500b\u7a0b\u5f0f\u5224\u65b7\u662f\u5426\u80fd\u5920\u6309\u6307\u5b9a\u6bd4\u4f8b\u88fd\u6210\u89e3\u85e5\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>\u8f38\u5165\u7b2c\u4e00\u5217\u6709\u56db\u500b\u6b63\u6574\u6578 A\u3001B\u3001C\u3001D (\u6578\u503c\u5747\u4e0d\u5927\u65bc 5\uff09\uff0c\u8868\u793a\u88fd\u4f5c\u89e3\u85e5\u7684\u56db\u7a2e\u6750\u6599\u6bd4\u4f8b\uff0c<strong>\u4fdd\u8b49\u5fc5\u6709\u4e00\u6578\u5b57\u70ba 1<\/strong>\u3002\u63a5\u8457\u7b2c\u4e8c\u5217\u6709\u4e00\u500b\u6574\u6578 N (3 \u2264 N \u2264 10\uff09\uff0c\u4ee3\u8868\u56db\u7a2e\u6750\u6599\u90fd\u5206\u6210\u5e7e\u5305\u3002\u6700\u5f8c\u56db\u5217\uff0c\u6bcf\u4e00\u5217\u6709 N \u500b\u6574\u6578 X\uff1a(1 \u2264 X \u2264 100\uff0c1 \u2264 i \u2264 N) \u5206\u5225\u4ee3\u8868\u6b64\u6750\u6599\u7684\u6bcf\u5c0f\u5305\u4efd\u91cf\u3002<\/td><td>\u8f38\u51fa\u4e00\u5217\u88fd\u4f5c\u6b64\u89e3\u85e5\u7684\u6bcf\u9805\u6750\u6599\u4efd\u91cf\uff0c\u82e5<strong>\u7121\u6cd5\u88fd\u4f5c\u89e3\u85e5\u5247\u8f38\u51fa-1<\/strong>\uff0c<strong>\u4fdd\u8b49\u7b54\u6848\u6700\u591a\u53ea\u6709\u4e00\u7d44\u89e3<\/strong>\u3002<\/td><\/tr><tr><td>1 2 1 3<br>5<br>2 9 5 8 1<br>8 3 1 4 5<br>1 6 5 2 7<br>4 3 6 9 8<\/td><td>2 4 2 6<\/td><\/tr><tr><td>1 2 1 3<br>3<br>2 9 5<br>8 3 1<br>1 6 5<br>4 3 1<\/td><td>-1<\/td><\/tr><tr><td>2 2 1 3<br>7<br>7 10 8 6 3 2 7<br>2 7 10 1 2 4 3<br>4 1 10 5 9 8 6<br>4 8 2 1 8 3 3<\/td><td>2 2 1 3<\/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=\"\">\u53ef\u4ee5\u4f7f\u7528\u9663\u5217\u5c07\u6bd4\u4f8b\u6536\u8d77\u4f86\uff0c\u7136\u5f8c\u5ba3\u544a\u4e00\u500b Vector&lt;map&lt;int, int>> \u4f86\u5b58\u6bcf\u4e00\u7a2e\u85e5\u5206\u5225\u6709\u54ea\u4e9b\u4efd\u91cf\u3002<\/p>\n\n\n\n<p class=\"\">\u8dd1\u4e00\u500b For\u8ff4\u5708\uff0c\u7576\u73fe\u5728\u7684\u85e5\u6bd4\u4f8b\u662f 1 \u6642\uff0c\u5c31\u628a\u9019\u7a2e\u85e5\u7684\u4efd\u91cf\u7576\u4f5c\u662f\u57fa\u6e96\uff0c\u53bb\u5176\u4ed6\u4e09\u7a2e\u85e5\u5c0b\u627e\u662f\u5426\u6709\u7b26\u5408\u6bd4\u4f8b\u7684\u85e5\u7269\uff0c\u5c07\u7b54\u6848\u5b58\u5728\u4e00\u500b\u9663\u5217\u4e2d\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\u7bc4\u4f8b\u7a0b\u5f0f\u78bc\uff0d<a href=\"https:\/\/zerojudge.tw\/ShowProblem?problemid=k514\" target=\"_blank\" rel=\"noreferrer noopener\">ZeroJudge K514: \u89e3\u85e5 (Medicine)<\/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;\nusing namespace std;\n\nint main() {\n    cin.sync_with_stdio(0);\n    cin.tie(0);\n    int ratio[4] = {}, N;\n    for (int & i : ratio) cin &gt;&gt; i;\n    cin &gt;&gt; N;\n    vector&lt;map&lt;int, int&gt;&gt;v;\n    for (int i = 0; i&lt;4; i++) {\n        map&lt;int, int&gt;MAP;\n        for (int j = 0; j&lt;N; j++) {\n            int tmp;\n            cin &gt;&gt; tmp;\n            MAP[tmp]++;\n        }\n        v.push_back(MAP);\n    }\n    bool no = true;\n    for (int i = 0; i&lt;4; i++) {\n        if (ratio[i] == 1) {\n            bool finish = false;\n            for (auto it:v[i]) {\n                const int num = it.first;\n                int ans[4] = {};\n                ans[i] = num;\n                bool ok = true;\n                for (int j = 0; j&lt;4; j++) {\n                    if (i == j) continue;\n                    if (v[j][num*ratio[j]] &gt; 0) ans[j] = num*ratio[j];\n                    else {\n                        ok = false;\n                        break;\n                    }\n                }\n                if (ok) {\n                    for (int j = 0; j&lt;4; j++) cout &lt;&lt; ans[j] &lt;&lt; &quot; &quot;;\n                    cout &lt;&lt; &quot;\\n&quot;;\n                    finish = true;\n                    break;\n                }\n            }\n            if (finish) {\n                no = false;\n                break;\n            }\n        }\n    }\n    if (no) cout &lt;&lt; -1 &lt;&lt; &quot;\\n&quot;;\n}\n\n\/\/ZeroJudge K514\n\/\/Dr. SeanXD<\/code><\/pre><\/div>\n","protected":false},"excerpt":{"rendered":"<p>\u5c0f\u96ea\u60a3\u4e86\u4e00\u7a2e\u5947\u602a\u7684\u50b3\u67d3\u75c5\uff0c\u8eab\u4e0a\u9577\u6eff\u4e86\u75b9\u5b50\uff0c\u5168\u8eab\u53c8\u75db\u53c8\u7662\u7684\uff0c\u5c31\u9023\u91ab\u751f\u4e5f\u67e5\u4e0d\u51fa\u75c5\u60c5\u3002\u6b63\u7576\u82e6\u60f1\u4e4b\u6642\uff0c\u6709\u4e00\u4f4d\u795e\u79d8\u5a46\u5a46\u7a81 [&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":[14,23,20,8,34,13,9],"class_list":["post-625","post","type-post","status-publish","format-standard","hentry","category-ioi-apcs","tag-map","tag-pair","tag-20","tag-8","tag-34","tag-13","tag-9"],"blocksy_meta":[],"_links":{"self":[{"href":"https:\/\/seanxd.com\/zh\/wp-json\/wp\/v2\/posts\/625","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=625"}],"version-history":[{"count":1,"href":"https:\/\/seanxd.com\/zh\/wp-json\/wp\/v2\/posts\/625\/revisions"}],"predecessor-version":[{"id":627,"href":"https:\/\/seanxd.com\/zh\/wp-json\/wp\/v2\/posts\/625\/revisions\/627"}],"wp:attachment":[{"href":"https:\/\/seanxd.com\/zh\/wp-json\/wp\/v2\/media?parent=625"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/seanxd.com\/zh\/wp-json\/wp\/v2\/categories?post=625"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/seanxd.com\/zh\/wp-json\/wp\/v2\/tags?post=625"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}