{"id":3206,"date":"2024-04-23T19:17:16","date_gmt":"2024-04-23T11:17:16","guid":{"rendered":"https:\/\/www.shuizilong.com\/house\/?p=3206"},"modified":"2024-04-28T23:51:48","modified_gmt":"2024-04-28T15:51:48","slug":"the-2023-icpc-world-finals-luxor","status":"publish","type":"post","link":"https:\/\/www.shuizilong.com\/house\/archives\/the-2023-icpc-world-finals-luxor\/","title":{"rendered":"The 2023 ICPC World Finals Luxor"},"content":{"rendered":"<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_65 counter-hierarchy ez-toc-counter ez-toc-grey ez-toc-container-direction\">\n<p class=\"ez-toc-title\">Table of Contents<\/p>\n<label for=\"ez-toc-cssicon-toggle-item-6a052ebe878d7\" class=\"ez-toc-cssicon-toggle-label\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/label><input type=\"checkbox\"  id=\"ez-toc-cssicon-toggle-item-6a052ebe878d7\"  aria-label=\"Toggle\" \/><nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/www.shuizilong.com\/house\/archives\/the-2023-icpc-world-finals-luxor\/#Problem_Y_Compression\" title=\"Problem Y. Compression\">Problem Y. Compression<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/www.shuizilong.com\/house\/archives\/the-2023-icpc-world-finals-luxor\/#Problem_P_Turning_Red\" title=\"Problem P. Turning Red\">Problem P. Turning Red<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/www.shuizilong.com\/house\/archives\/the-2023-icpc-world-finals-luxor\/#Problem_W_Riddle_of_the_Sphinx\" title=\"Problem W. Riddle of the Sphinx\">Problem W. Riddle of the Sphinx<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/www.shuizilong.com\/house\/archives\/the-2023-icpc-world-finals-luxor\/#Problem_Q_Doing_the_Container_Shuffle\" title=\"Problem Q. Doing the Container Shuffle\">Problem Q. Doing the Container Shuffle<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/www.shuizilong.com\/house\/archives\/the-2023-icpc-world-finals-luxor\/#Problem_V_Three_Kinds_of_Dice\" title=\"Problem V. Three Kinds of Dice\">Problem V. Three Kinds of Dice<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/www.shuizilong.com\/house\/archives\/the-2023-icpc-world-finals-luxor\/#Problem_T_Carls_Vacation\" title=\"Problem T. Carl\u2019s Vacation\">Problem T. Carl\u2019s Vacation<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/www.shuizilong.com\/house\/archives\/the-2023-icpc-world-finals-luxor\/#Problem_X_Quartets\" title=\"Problem X. Quartets\">Problem X. Quartets<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-8\" href=\"https:\/\/www.shuizilong.com\/house\/archives\/the-2023-icpc-world-finals-luxor\/#Problem_R_Zoo_Management\" title=\"Problem R. Zoo Management\">Problem R. Zoo Management<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-9\" href=\"https:\/\/www.shuizilong.com\/house\/archives\/the-2023-icpc-world-finals-luxor\/#Problem_S_Bridging_the_Gap\" title=\"Problem S. Bridging the Gap\">Problem S. Bridging the Gap<\/a><\/li><\/ul><\/nav><\/div>\n\n<p>\u9996\u5148\u606d\u559c jly!!! Orz\uff0c\u7136\u540e\u600e\u4e48\u8fd8\u6ca1\u4eba\u5199\u9898\u89e3\uff1f\u6211\u6765\u5bf9\u7740\u6807\u7a0b\u53e3\u80e1\u4e00\u4e0b = =\u3002<\/p>\n<ul>\n<li><a href=\"https:\/\/codeforces.com\/blog\/entry\/128559\">https:\/\/codeforces.com\/blog\/entry\/128559<\/a><\/li>\n<li><a href=\"https:\/\/github.com\/SnapDragon64\/ACMFinalsSolutions\/tree\/master\/finals2023\">https:\/\/github.com\/SnapDragon64\/ACMFinalsSolutions\/tree\/master\/finals2023<\/a><\/li>\n<\/ul>\n<h2><span class=\"ez-toc-section\" id=\"Problem_Y_Compression\"><\/span>Problem Y. Compression<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>\u76f8\u90bb\u7684\u76f8\u540c\u5143\u7d20\u90fd\u5148\u538b\u7f29\u6389\uff0c\u7136\u540e\u56e0\u4e3a\u53ea\u6709..010101&#8230; \u6240\u4ee5\u8fde\u7eed\u5220\u9664\u672b\u5c3e\u5076\u6570\u4e2a\u5b57\u7b26\uff0c\u76f4\u5230\u957f\u5ea6 &lt;= 3 \u5373\u53ef\u3002<\/p>\n<h2><span class=\"ez-toc-section\" id=\"Problem_P_Turning_Red\"><\/span>Problem P. Turning Red<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>\u7b2c\u4e00\u53cd\u5e94\u89e3\u6a21\u7ebf\u6027\u65b9\u7a0b\uff0c\u4f46\u662f\u6709\u4e00\u4e2a\u706f\u81f3\u591a\u53ea\u5173\u8054\u4e24\u4e2a\u6309\u94ae\u8fd9\u4e2a\u989d\u5916\u6761\u4ef6\uff0c\u56e0\u800c\u77e5\u9053\u4e00\u4e2a\u6309\u94ae\u7684\u72b6\u6001\uff0c\u5c31\u80fd\u7acb\u523b\u63a8\u51fa\u53e6\u4e00\u4e2a\uff0c\u4e8e\u662f\u5c31\u53d8\u6210\u7b7e\u5230\u9898\u4e86\u3002<\/p>\n<p>\u6211\u4eec\u5c06\u706f\u548c\u6309\u94ae\u89c6\u4f5c\u4e8c\u5206\u56fe\uff0c\u5bf9\u4e8e\u6bcf\u4e2a\u8fde\u901a\u5757\uff0c\u6211\u4eec\u53ea\u9700\u8981\u679a\u4e3e\u5176\u4e2d\u4efb\u610f\u4e00\u4e2a\u6309\u94ae\u7684\u72b6\u6001\uff0c\u5176\u5b83\u6309\u94ae\u7684\u72b6\u6001\u5c31\u90fd\u80fd\u786e\u5b9a\uff0c\u5728 dfs \u7684\u8fc7\u7a0b\u4e2d\u770b\u6709\u6ca1\u6709\u77db\u76fe\u5373\u53ef\uff0c\u4ee3\u7801\u4e5f\u5f88\u50cf\u4e8c\u5206\u56fe\u5224\u5b9a\u3002<\/p>\n<h2><span class=\"ez-toc-section\" id=\"Problem_W_Riddle_of_the_Sphinx\"><\/span>Problem W. Riddle of the Sphinx<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>\u8111\u7ecf\u6025\u8f6c\u5f2f\uff0c\u5148\u95ee a,b,c,a+b+c\uff0c\u5982\u679c\u4e0d\u81ea\u6d3d\u90a3\u4e48\u8981\u4e48\u662f\u524d\u9762 a,b,c \u9519\uff0c\u90a3\u4e48 a+b+c \u9519\u3002\u6b64\u65f6\u6211\u4eec\u518d\u95ee a+2b+3c\uff0c\u5982\u679c\u548c a,b,c \u4ecd\u7136\u4e0d\u81ea\u6d3d\u90a3\u4e48\u8bf4\u660e\u5176\u4e2d\u6709\u4e00\u4e2a\u662f\u5047\u7684\uff0c\u4f46\u6b64\u65f6\u6211\u4eec\u53ef\u4ee5\u901a\u8fc7\u540e\u4e24\u95ee\u7684\u7ebf\u6027\u7ec4\u5408\uff0c\u5f97\u5230\u4e0d\u4f9d\u8d56\u5176\u4e2d\u4e00\u4e2a\u5143\u7d20\u4e14\u767e\u5206\u767e\u6b63\u786e\u7684\u8be2\u95ee\uff0c\u4ece\u800c\u5bfb\u627e\u51fa\u54ea\u4e00\u4e2a\u8be2\u95ee\u4e3a\u5047\u3002<\/p>\n<h2><span class=\"ez-toc-section\" id=\"Problem_Q_Doing_the_Container_Shuffle\"><\/span>Problem Q. Doing the Container Shuffle<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>\u975e\u5e38\u6709\u8da3\u7684\u6982\u7387\u9898\uff0c\u7b2c\u4e00\u53cd\u5e94\u5f53\u7136\u662f\u5229\u7528\u671f\u671b\u7684\u7ebf\u6027\u6027\u8d28\uff0c\u6bcf\u4e2a\u8f6e\u6b21\u72ec\u7acb\u8ba8\u8bba\uff0c\u611f\u89c9\u50cf\u662f\u67d0\u79cd\u9006\u5e8f\u5bf9\u7684\u677f\u5b50\u3002<\/p>\n<p>\u4f46\u662f\u6709\u4e2a\u9ebb\u70e6\u7684\u70b9\u662f\u8fd9\u4e2a\u79fb\u52a8\u7684\u8fc7\u7a0b\u4f1a\u6709\u4e00\u4e9b\u540e\u6548\u6027\uff0c\u7834\u574f\u4e4b\u540e\u7684\u72b6\u6001\u3002\u3002\u3002<br \/>\n\u4f46\u662f\u53d1\u73b0\u5206\u7c7b\u8ba8\u8bba\u4e4b\u540e\uff0c\u8fd9\u4e2a\u8fc7\u7a0b\u5c45\u7136\u4ea7\u751f\u7684\u5f71\u54cd\u4e5f\u662f\u5c40\u90e8\u7684\uff01\u76f4\u63a5\u53d6 min(cur, last) \u8fdb\u884c\u6bcf\u4e2a\u8f6e\u6b21\u7684\u8be2\u95ee\u5373\u53ef Orz\u3002<\/p>\n<h2><span class=\"ez-toc-section\" id=\"Problem_V_Three_Kinds_of_Dice\"><\/span>Problem V. Three Kinds of Dice<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>\u770b\u8d77\u6765\u53c8\u662f\u6982\u7387\u9898\uff0c\u4f46\u5b9e\u9645\u662f\u51e0\u4f55\u9898\u3002<\/p>\n<p>\u9996\u5148\u8003\u8651\u7b2c\u4e09\u679a\u9ab0\u5b50\u53ea\u6709\u4e00\u9762\u7684\u60c5\u51b5\uff0c\u6211\u4eec\u679a\u4e3e\u5b83\u7684\u53d6\u503c\uff0c\u5c31\u53ef\u4ee5\u5feb\u901f\u6c42\u51fa\u5bf9\u53e6\u5916\u4e24\u4e2a\u9ab0\u5b50\u7684\u80dc\u7387\u3002\u7136\u540e x\u3001y \u8f74\u5206\u522b\u662f\u5bf9\u53e6\u5916\u4e24\u4e2a\u9ab0\u5b50\u7684\u80dc\u7387\uff0c\u6211\u4eec\u53d1\u73b0\u8fd9\u4e9b\u53d6\u503c\u5728\u5e73\u9762\u4e0a\u5f62\u6210\u4e00\u4e9b\u79bb\u6563\u7684\u70b9\uff0c\u800c\u4efb\u610f\u591a\u9762\u7684\u60c5\u51b5\uff0c\u5c31\u662f\u8fd9\u4e9b\u79bb\u6563\u7684\u70b9\u5728\u5e73\u9762\u4e0a\u7684\u7ebf\u6027\u7ec4\u5408\u6240\u6784\u6210\u7684\u533a\u57df\uff0c\u7136\u540e lrj \u66fe\u7ecf\u544a\u8bc9\u6211\u4eec\uff0c\u8fd9\u4e2a\u4e1c\u897f\u5176\u5b9e\u662f\u4e00\u4e2a\u51f8\u5305\u3002\u6700\u540e\u53ea\u8981\u5728\u8fd9\u4e2a\u51f8\u5305\u4e0a\u505a\u4e24\u6761\u5c04\u7ebf\u5373\u53ef\u3002<\/p>\n<h2><span class=\"ez-toc-section\" id=\"Problem_T_Carls_Vacation\"><\/span>Problem T. Carl\u2019s Vacation<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>\u4e09\u5206\u5957\u4e09\u5206\u3002<\/p>\n<h2><span class=\"ez-toc-section\" id=\"Problem_X_Quartets\"><\/span>Problem X. Quartets<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>\u770b\u8d77\u6765\u5f88\u50cf\u662f\u5e76\u67e5\u96c6\uff08\u98df\u7269\u94fe\uff09\u4ec0\u4e48\u7684\uff0c\u4f46\u662f\u597d\u50cf\u662f\u7f51\u7edc\u6d41\u3002\u3002\u53cd\u6b63\u6211\u8fd8\u6ca1\u6574\u660e\u767d\u56e7\u3002<\/p>\n<h2><span class=\"ez-toc-section\" id=\"Problem_R_Zoo_Management\"><\/span>Problem R. Zoo Management<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>\u8bf4\u7ed9\u4f60\u4e00\u4e2a\u56fe\uff0c\u6bcf\u4e2a\u7ed3\u70b9\u6709\u4e00\u4e2a\u6807\u53f7\uff0c\u4f60\u552f\u4e00\u53ef\u4ee5\u8c03\u6574\u6807\u53f7\u7684\u65b9\u6cd5\uff0c\u662f\u6cbf\u7740\u73af\u65cb\u8f6c\u3002<br \/>\n\u95ee\u662f\u5426\u80fd\u4ece\u521d\u59cb\u72b6\u6001\u65cb\u8f6c\u6210\u76ee\u6807\u72b6\u6001\u3002<\/p>\n<p>\u603b\u611f\u89c9\u5728\u54ea\u89c1\u8fc7= =<\/p>\n<p>\u9996\u5148\u6865\u8fb9\u65e0\u6cd5\u8054\u7edc\uff0c\u6240\u4ee5\u5148\u6c42 bcc\uff0c\u6bcf\u4e2a\u53cc\u8054\u901a\u5206\u652f\u72ec\u7acb\u8ba8\u8bba\uff0c\u7528\u62bd\u8c61\u4ee3\u6570\u7684\u77e5\u8bc6\u5efa\u6a21\uff1a<br \/>\n&#8211; \u73af\uff0c\u90a3\u4e48\u64cd\u4f5c\u6784\u6210\u5faa\u73af\u7fa4\uff0c\u662f\u6700\u7b80\u5355\u7684\u60c5\u51b5\uff0c\u7b49\u4ef7\u4e8e\u5224\u5b9a\u5b57\u7b26\u4e32\u5faa\u73af\u540c\u6784\u3002\u3002\u53ef\u4ee5 <a href=\"https:\/\/oi-wiki.org\/string\/minimal-string\/\">https:\/\/oi-wiki.org\/string\/minimal-string\/<\/a> \uff08\u4e5f\u53ef\u4ee5\u540e\u7f00\u81ea\u52a8\u673a\uff09<br \/>\n&#8211; \u4ed9\u4eba\u638c\uff0c\u90a3\u4e48\u6784\u6210\u5bf9\u79f0\u7fa4\uff0c\u76f4\u63a5\u8fd4\u56de yes\u3002<br \/>\n&#8211; \u5176\u5b83\u60c5\u51b5\uff0c\u90a3\u4e48\u6784\u6210\u4ea4\u9519\u7fa4\uff0c\u6c42\u4e00\u4e0b\u9006\u5e8f\u5bf9\u3002<\/p>\n<p>\u540e\u9762\u4e24\u79cd\u60c5\u51b5\u771f\u7684\u4e00\u70b9\u4e5f\u4e0d\u663e\u7136\uff0c\u95ee\u5c31\u662f\u603b\u611f\u89c9\u5728\u54ea\u89c1\u8fc7\u3002\u3002\u3002= =<br \/>\n<a href=\"https:\/\/en.wikipedia.org\/wiki\/Jordan%27s_theorem_%28symmetric_group%29\">https:\/\/en.wikipedia.org\/wiki\/Jordan%27s_theorem_%28symmetric_group%29<\/a><\/p>\n<h2><span class=\"ez-toc-section\" id=\"Problem_S_Bridging_the_Gap\"><\/span>Problem S. Bridging the Gap<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p><a href=\"https:\/\/www.shuizilong.com\/house\/wp-content\/uploads\/2024\/04\/\u622a\u5c4f2024-04-27-7.01.23.png\"><img loading=\"lazy\" decoding=\"async\" data-attachment-id=\"3218\" data-permalink=\"https:\/\/www.shuizilong.com\/house\/archives\/the-2023-icpc-world-finals-luxor\/%e6%88%aa%e5%b1%8f2024-04-27-7-01-23\/\" data-orig-file=\"https:\/\/www.shuizilong.com\/house\/wp-content\/uploads\/2024\/04\/\u622a\u5c4f2024-04-27-7.01.23.png\" data-orig-size=\"842,1034\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"\u622a\u5c4f2024-04-27 7.01.23\" data-image-description=\"\" data-image-caption=\"\" data-medium-file=\"https:\/\/www.shuizilong.com\/house\/wp-content\/uploads\/2024\/04\/\u622a\u5c4f2024-04-27-7.01.23.png\" data-large-file=\"https:\/\/www.shuizilong.com\/house\/wp-content\/uploads\/2024\/04\/\u622a\u5c4f2024-04-27-7.01.23.png\" src=\"https:\/\/www.shuizilong.com\/house\/wp-content\/uploads\/2024\/04\/\u622a\u5c4f2024-04-27-7.01.23.png\" alt=\"\" width=\"842\" height=\"1034\" class=\"aligncenter size-full wp-image-3218\" \/><\/a><\/p>\n<p>\u975e\u5e38\u5e05\u7684\u4e00\u4e2a\u9898\uff0c\u8fc7\u6865\u95ee\u9898\u60f3\u5fc5\u5927\u5bb6\u90fd\u89c1\u8fc7\uff0c\u300a\u5927\u822a\u6d77\u65f6\u4ee3 IV\u300b\u91cc\u8fd8\u662f\u54ea\u4e00\u4e2a\u9057\u8ff9\u7684\u8c1c\u9898\u6211\u5fd8\u4e86\uff0c\u7136\u540e\u5c0f\u65f6\u5019\u770b\u7684\u4e00\u672c\u5434\u6587\u864e\u7684\u56fe\u8bba\u5c0f\u518c\u5b50\u5f00\u7bc7\u4e5f\u662f\u8fd9\u4e2a\u8c1c\u9898\u3002\u8fd9\u4e2a\u9898\u662f\u539f\u7248\u95ee\u9898\u7684\u5a01\u529b\u52a0\u5f3a\u7248\uff0c\u53d8\u6210 n \u4e2a\u4eba\uff0c\u6865\u4e0a\u6700\u591a\u80fd\u8fc7 c \u4eba\uff0c\u6bcf\u4e2a\u4eba\u7ed9\u4e00\u4e2a\u901a\u8fc7\u65f6\u95f4\uff0c\u770b\u4f3c\u4fee\u6539\u4e0d\u591a\uff0c\u4f46\u96be\u5ea6\u4e00\u4e0b\u5b50\u5c31\u4e0a\u6765\u4e86\u56e7\u3002<\/p>\n<p>\u6211\u5bf9\u7740 std \u548c\u9898\u89e3\u89c6\u9891\uff08which is wrong\uff09\u5927\u773c\u77aa\u5c0f\u773c\u60f3\u4e86\u597d\u51e0\u5929\u90fd\u6ca1\u60f3\u901a\uff0c\u6700\u540e\u8fd8\u662f\u7f9e\u803b\u7684\u8dd1\u53bb\u770b\u4e86\u8bba\u6587\uff0c\u770b\u5230\u4e00\u534a\u7ec8\u4e8e\u609f\u4e86\u3002<br \/>\n\u9996\u5148 std \u5f00\u5e55\u96f7\u51fb\u3002\u3002\u90a3\u4e2a\u795e\u4f3c\u80cc\u5305\u7684\uff08\u5c31\u662f\u80cc\u5305\uff0c\u8fd8\u662f\u5b8c\u5168\u80cc\u5305\uff09 \u7684 cc \u6211\u5c31\u770b\u4e0d\u61c2\u3002\u3002<br \/>\n\u8fd9\u662f\u56e0\u4e3a\u6211\u4eec\u5bf9\u8fc7\u6cb3\u7684\u7ed3\u6784\u7f3a\u4e4f insight \u5bfc\u81f4\u7684\u3002\u3002\u3002\u8bba\u6587\u5927\u90e8\u5206\u90fd\u5728\u7814\u7a76\u8fd9\u4e2a\u7ed3\u6784\uff0c\u5e76\u4e0d\u65ad\u7b80\u5316\u3002\u3002\u3002<\/p>\n<p>\u9996\u5148\u6709\u4e00\u79cd\u6700\u76f4\u89c9\u7684\u8d2a\u5fc3\u3002\u3002\u5c31\u662f\u6700\u5feb\u7684\u4eba\u53cd\u590d\u8fc7\u6cb3\u53bb\u5e26\u5176\u4ed6\u4eba\u3002\u3002\u3002<br \/>\n\u5f88\u9057\u61be\uff0c\u6837\u4f8b\u5b83\u5c31\u9519\u4e86\u3002\u3002\u3002\u6211\u4eec\u53d1\u73b0\u6837\u4f8b\u91cc\u6709\u6700\u6162\u7684\u4e24\u4e2a\u4eba\u4e00\u8d77\u8fc7\u6cb3\u7684\u60c5\u51b5\u3002\u3002\u8fd9\u6837\u6b21\u6162\u7684\u90a3\u4e2a\u4eba\u5c31\u53ef\u4ee5\u907f\u514d\u6210\u4e3a\u74f6\u9888\u88ab\u7edf\u8ba1\u3002\u3002\u3002<\/p>\n<p>\u4f46\u662f\u6211\u4eec\u8fd8\u662f\u5148\u627e\u627e\u8fd9\u4e2a\u8d2a\u5fc3\u6709\u54ea\u4e9b\u5730\u65b9\u662f\u505a\u7684\u5bf9\u4e86\uff01\uff01<\/p>\n<p>\u9996\u5148\u3002\u3002\u56de\u6765\u7684\u961f\u4f0d\u4e00\u5b9a\u662f\u5355\u72ec\u4e00\u4e2a\u4eba\u3002\u3002\u3002\u591a\u56de\u53bb\u6ca1\u610f\u4e49\u3002\uff08\u72b6\u6001\u76f4\u63a5\u51cf\u534a\u6709\u6ca1\u6709\uff01\uff09<br \/>\n\u5176\u6b21\u3002\u3002\u6700\u5feb\u7684\u90a3\u4e2a\u4eba\u786e\u5b9e\u662f\u6700\u6709\u6210\u4e3a\u706b\u70ac\u624b\u7684\u6f5c\u529b\u7684\u3002\u3002<br \/>\n\u6240\u4ee5\u6211\u4eec\u5148\u5bf9\u6240\u6709\u4eba\u6309\u901f\u5ea6\u4ece\u6162\u5230\u5feb\u6392\u5e8f\uff0c\u603b\u662f\u5148\u60f3\u529e\u6cd5\u628a\u5f53\u524d\u6700\u6162\u7684\u4e00\u6279\u4eba\u9001\u8fc7\u6cb3\u3002\u3002<\/p>\n<p>&#8230;<\/p>\n<p>\u7ecf\u8fc7\u4e00\u756a\u6323\u624e\u3002\u3002\u6211\u4eec\u53d1\u73b0\u5b9e\u9645\u4e0a\u8fc7\u6cb3\u7684\u961f\u4f0d\u53ea\u6709\u4e09\u79cd\u60c5\u51b5\u3002\u3002\u3002<br \/>\n\u7b2c\u4e00\u79cd\u3002\u3002\u5f53\u524d C \u4e2a\u6700\u6162\u7684\u4eba\u3002\u3002\u8fd9 C \u4e2a\u4eba\u6c38\u8fdc\u4e0d\u4f1a\u56de\u6765\u3002\u3002\u6240\u4ee5\u9664\u975e\u5b83\u4eec\u662f\u6700\u540e\u4e00\u6279\uff0c\u5426\u5219\u9700\u8981\u4e4b\u524d\u81f3\u5c11\u6709\u4e00\u4e2a\u5148\u950b\u961f\u6210\u5458\u5728\u53f3\u5cb8\u3002\u3002\uff08\u5b9a\u4e49\u4e00\u4e0b\u5148\u950b\u961f\uff0c\u5c31\u662f\u8fc7\u4e86\u6cb3\u8fd8\u4f1a\u56de\u6765\u7684\u540c\u5fd7\uff0c\u4e00\u5b9a\u662f\u901f\u5ea6\u6700\u5feb\u7684\u90a3\u4e00\u6ce2\u4eba\uff09<br \/>\n\u7b2c\u4e8c\u79cd\uff0c\u5f53\u524d C-i \u4e2a\u6700\u6162\u7684\u4eba\uff0c\u548c i \u4e2a\u6700\u5feb\u7684\u4eba\uff0c\u8fd9 i \u4e2a\u5148\u950b\u961f\u6210\u5458\u91cc\u9664\u4e86 1 \u4e2a\u4eba\u8981\u7acb\u523b\u8fd4\u56de\u4e4b\u5916\uff0c\u5269\u4e0b i-1 \u4e2a\u6210\u5458\u4e4b\u540e\u53ef\u4ee5\u5f53\u4f5c\u8d44\u6e90\u518d\u5229\u7528\u3002\u3002\u3002\u800c\u6211\u4eec\u4e0a\u9762\u7684\u8d2a\u5fc3\uff0c\u5b9e\u9645\u6070\u597d\u5bf9\u5e94\u4e86\u6bcf\u8f6e\u6b21\u90fd\u81ea\u4ea7\u81ea\u9500\u7684\u60c5\u51b5\u3002\u3002<br \/>\n\u6700\u540e\u4e00\u79cd\u3002\u3002\u3002\u5f53\u524d\u6700\u5feb\u7684 i \u4e2a\u4eba\u3002\u3002\u3002\u8fd9\u79cd\u60c5\u51b5\u7eaf\u7cb9\u4e3a\u4e86\u4ea7\u751f\u66f4\u591a\u7684\u5148\u950b\u961f\u3002\u3002<\/p>\n<p>\u6240\u4ee5 dp[i][j] \u5c31\u662f\uff0c\u5df2\u7ecf\u8fd0\u5b8c\u4e86\u524d i \u4eba\uff08\u4ece\u6162\u5230\u5feb\uff09\uff0c\u4e14\u8fd8\u5012\u6b20 j \u4e2a\u5148\u950b\u961f\u7684\u60c5\u51b5\u3002\u3002\u3002\u3002<br \/>\n\u8fd9\u79cd\u901a\u8fc7\u7535\u8868\u5012\u8f6c\uff0c\u5f15\u5165\u672a\u6765\u72b6\u6001\u7684 dp \u6280\u5de7\u3002\u3002\u6211\u4eec\u4e5f\u4e0d\u662f\u6ca1\u89c1\u8fc7\u3002\u3002\u5bf9\u5427\uff01\uff08\u4f46\u662f\u8fd9\u4e2a\u9898\u91cc\u6709\u6b63\u6709\u8d1f\uff09\uff08<a href=\"https:\/\/www.spoj.com\/problems\/ZUMA\/\">https:\/\/www.spoj.com\/problems\/ZUMA\/<\/a><\/p>\n<p>\u518d\u56de\u987e\u4e00\u4e0b\u4e0a\u9762\u7684\u4e09\u79cd\u60c5\u51b5\u3002\u3002\u3002<br \/>\n1. \u7eaf\u8d2b\u4e0b\u4e2d\u519c\u961f\u4f0d\uff08\u900f\u652f 1 \u4e2a\u5148\u950b\u961f\uff09<br \/>\n2. i \u4e2a\u5148\u950b\u961f\u6210\u5458\u5e26\u9886 C-i \u4e2a\u8d2b\u4e0b\u4e2d\u519c\u7ec4\u6210\u7684\u6df7\u5408\u961f\u4f0d\uff0c\uff08\u79ef\u6512 i-1 \u4e2a\u5148\u950b\u961f\uff09<br \/>\n3. \u7eaf i \u4e2a\u5148\u950b\u961f\u6210\u5458\u7ec4\u6210\u7684\u5148\u950b\u961f\u4f0d\uff08\u79ef\u6512 i \u4e2a\u5148\u950b\u961f\uff09<\/p>\n<p>\u7136\u540e\u6700\u540e\u8fd9\u4e2a\u4ee3\u7801\u91cc\u7684\u5b8c\u5168\u80cc\u5305\u73b0\u5728\u4e5f\u5f88\u597d\u4e3d\u6d01\u4e86\u5427\uff01\u5c31\u662f\u5bf9\u5e94\u4e0a\u9762\u5206\u6790\u7684\u6700\u540e\u4e00\u79cd\u60c5\u51b5\uff0c\u56e0\u4e3a\u8fd9\u79cd\u60c5\u51b5\u5bf9\u987a\u5e8f\u4e0d\u654f\u611f\uff0c\u6211\u4eec\u5355\u72ec\u62ce\u51fa\u6765\u5904\u7406\uff0c\u6781\u5927\u7684\u964d\u4f4e\u601d\u8003\u590d\u6742\u5ea6\uff0c\u7136\u540e 1 \u548c 2 \u5b9e\u9645\u53ef\u4ee5\u5408\u5e76\u6210\u4e00\u79cd\u72b6\u6001\u8f6c\u79fb\u6765\u679a\u4e3e\uff0c\u4ee3\u7801\u91cc\u7684\uff1a<br \/>\n&#8211; mnc \u5c31\u662f\u6700\u591a\u5012\u6b20\u51e0\u4e2a\u5148\u950b\u961f\u53ef\u4ee5 clear\u3002\uff08\u4fdd\u8bc1\u4e86\u590d\u6742\u5ea6\u662f O(n2)\uff09<br \/>\n&#8211; mxc \u5c31\u662f\u6700\u591a\u5f53\u524d\u53ef\u6512\u591a\u5c11\u4e2a\u5148\u950b\u961f\u3002\uff08\u518d\u591a\u5c31\u6ea2\u51fa\u540e\u9762\u6ca1\u5fc5\u8981\u4e86\uff0c\u7b97\u662f\u4e2a\u5c0f\u4f18\u5316\uff09<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u9996\u5148\u606d\u559c jly!!! Orz\uff0c\u7136\u540e\u600e\u4e48\u8fd8\u6ca1\u4eba\u5199\u9898\u89e3\uff1f\u6211\u6765\u5bf9\u7740\u6807\u7a0b\u53e3\u80e1\u4e00\u4e0b = =\u3002 https:\/\/codeforces.com\/blog\/entry\/128559 https:\/\/github.com\/SnapDragon64\/ACMFinalsSolutions\/tree\/master\/finals2023 Problem Y. Compression \u76f8\u90bb\u7684\u76f8\u540c\u5143\u7d20\u90fd\u5148\u538b\u7f29\u6389\uff0c\u7136\u540e\u56e0\u4e3a\u53ea\u6709..010101&#8230; \u6240\u4ee5\u8fde\u7eed\u5220\u9664\u672b\u5c3e\u5076\u6570\u4e2a\u5b57\u7b26\uff0c\u76f4\u5230\u957f\u5ea6 &lt;= 3 \u5373\u53ef\u3002 Problem P. Turning Red \u7b2c\u4e00\u53cd\u5e94\u89e3\u6a21\u7ebf\u6027\u65b9\u7a0b\uff0c\u4f46\u662f\u6709\u4e00\u4e2a\u706f\u81f3\u591a\u53ea\u5173\u8054\u4e24\u4e2a\u6309\u94ae\u8fd9\u4e2a\u989d\u5916\u6761\u4ef6\uff0c\u56e0\u800c\u77e5\u9053\u4e00\u4e2a\u6309\u94ae\u7684\u72b6\u6001\uff0c\u5c31\u80fd\u7acb\u523b\u63a8\u51fa\u53e6\u4e00\u4e2a\uff0c\u4e8e\u662f\u5c31\u53d8\u6210\u7b7e\u5230\u9898\u4e86\u3002 \u6211\u4eec\u5c06\u706f\u548c\u6309\u94ae\u89c6\u4f5c\u4e8c\u5206\u56fe\uff0c\u5bf9\u4e8e\u6bcf\u4e2a\u8fde\u901a\u5757\uff0c\u6211\u4eec\u53ea\u9700\u8981\u679a\u4e3e\u5176\u4e2d\u4efb\u610f\u4e00\u4e2a\u6309\u94ae\u7684\u72b6\u6001\uff0c\u5176\u5b83\u6309\u94ae\u7684\u72b6\u6001\u5c31\u90fd\u80fd\u786e\u5b9a\uff0c\u5728 dfs \u7684\u8fc7\u7a0b\u4e2d\u770b\u6709\u6ca1\u6709\u77db\u76fe\u5373\u53ef\uff0c\u4ee3\u7801\u4e5f\u5f88\u50cf\u4e8c\u5206\u56fe\u5224\u5b9a\u3002 Problem W. Riddle of the Sphinx \u8111\u7ecf\u6025\u8f6c\u5f2f\uff0c\u5148\u95ee a,b,c,a+b+c\uff0c\u5982\u679c\u4e0d\u81ea\u6d3d\u90a3\u4e48\u8981\u4e48\u662f\u524d\u9762 a,b,c \u9519\uff0c\u90a3\u4e48 a+b+c \u9519\u3002\u6b64\u65f6\u6211\u4eec\u518d\u95ee a+2b+3c\uff0c\u5982\u679c\u548c a,b,c \u4ecd\u7136\u4e0d\u81ea\u6d3d\u90a3\u4e48\u8bf4\u660e\u5176\u4e2d\u6709\u4e00\u4e2a\u662f\u5047\u7684\uff0c\u4f46\u6b64\u65f6\u6211\u4eec\u53ef\u4ee5\u901a\u8fc7\u540e\u4e24\u95ee\u7684\u7ebf\u6027\u7ec4\u5408\uff0c\u5f97\u5230\u4e0d\u4f9d\u8d56\u5176\u4e2d\u4e00\u4e2a\u5143\u7d20\u4e14\u767e\u5206\u767e\u6b63\u786e\u7684\u8be2\u95ee\uff0c\u4ece\u800c\u5bfb\u627e\u51fa\u54ea\u4e00\u4e2a\u8be2\u95ee\u4e3a\u5047\u3002 Problem Q. Doing the Container Shuffle \u975e\u5e38\u6709\u8da3\u7684\u6982\u7387\u9898\uff0c\u7b2c\u4e00\u53cd\u5e94\u5f53\u7136\u662f\u5229\u7528\u671f\u671b\u7684\u7ebf\u6027\u6027\u8d28\uff0c\u6bcf\u4e2a\u8f6e\u6b21\u72ec\u7acb\u8ba8\u8bba\uff0c\u611f\u89c9\u50cf\u662f\u67d0\u79cd\u9006\u5e8f\u5bf9\u7684\u677f\u5b50\u3002 \u4f46\u662f\u6709\u4e2a\u9ebb\u70e6\u7684\u70b9\u662f\u8fd9\u4e2a\u79fb\u52a8\u7684\u8fc7\u7a0b\u4f1a\u6709\u4e00\u4e9b\u540e\u6548\u6027\uff0c\u7834\u574f\u4e4b\u540e\u7684\u72b6\u6001\u3002\u3002\u3002 \u4f46\u662f\u53d1\u73b0\u5206\u7c7b\u8ba8\u8bba\u4e4b\u540e\uff0c\u8fd9\u4e2a\u8fc7\u7a0b\u5c45\u7136\u4ea7\u751f\u7684\u5f71\u54cd\u4e5f\u662f\u5c40\u90e8\u7684\uff01\u76f4\u63a5\u53d6 min(cur, last) \u8fdb\u884c\u6bcf\u4e2a\u8f6e\u6b21\u7684\u8be2\u95ee\u5373\u53ef Orz\u3002 Problem V. Three Kinds [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","enabled":false}}},"categories":[1],"tags":[],"class_list":["post-3206","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p2tdP7-PI","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.shuizilong.com\/house\/wp-json\/wp\/v2\/posts\/3206","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.shuizilong.com\/house\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.shuizilong.com\/house\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.shuizilong.com\/house\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.shuizilong.com\/house\/wp-json\/wp\/v2\/comments?post=3206"}],"version-history":[{"count":21,"href":"https:\/\/www.shuizilong.com\/house\/wp-json\/wp\/v2\/posts\/3206\/revisions"}],"predecessor-version":[{"id":3228,"href":"https:\/\/www.shuizilong.com\/house\/wp-json\/wp\/v2\/posts\/3206\/revisions\/3228"}],"wp:attachment":[{"href":"https:\/\/www.shuizilong.com\/house\/wp-json\/wp\/v2\/media?parent=3206"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.shuizilong.com\/house\/wp-json\/wp\/v2\/categories?post=3206"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.shuizilong.com\/house\/wp-json\/wp\/v2\/tags?post=3206"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}