{"id":2043,"date":"2022-11-13T07:09:33","date_gmt":"2022-11-12T23:09:33","guid":{"rendered":"https:\/\/www.shuizilong.com\/house\/?p=2043"},"modified":"2023-01-16T03:29:58","modified_gmt":"2023-01-15T19:29:58","slug":"icpc-world-final-2021","status":"publish","type":"post","link":"https:\/\/www.shuizilong.com\/house\/archives\/icpc-world-final-2021\/","title":{"rendered":"ICPC World Final 2021"},"content":{"rendered":"<h1><span class=\"ez-toc-section\" id=\"%E4%BC%A0%E9%80%81%E9%97%A8\"><\/span>\u4f20\u9001\u95e8<span class=\"ez-toc-section-end\"><\/span><\/h1>\n<ul>\n<li><a href=\"https:\/\/judge.icpc.global\/team\">\u63d0\u4ea4\u5730\u5740<\/a><\/li>\n<li><a href=\"https:\/\/www.zhihu.com\/question\/565649278\/answer\/2751732765\">\u524d\u60c5\u63d0\u8981<\/a><\/li>\n<li><a href=\"https:\/\/www.youtube.com\/watch?v=Ufkp1zxZOh0&#038;list=PLm9puTBNlJjV3oX0IbMqeLBT0nSjLwvzM&#038;index=15&#038;ab_channel=ICPCNews\">\u5b98\u65b9\u9898\u89e3<\/a><\/li>\n<li><a href=\"https:\/\/github.com\/lychees\/ACM-Training\/tree\/master\/Archive\/World%20Final\/2021%20Dhaka\">\u4ee3\u7801<\/a><\/li>\n<\/ul>\n<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-6a1e5ccdb367f\" 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-6a1e5ccdb367f\"  aria-label=\"Toggle\" \/><nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-1'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/www.shuizilong.com\/house\/archives\/icpc-world-final-2021\/#%E4%BC%A0%E9%80%81%E9%97%A8\" title=\"\u4f20\u9001\u95e8\">\u4f20\u9001\u95e8<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-1'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/www.shuizilong.com\/house\/archives\/icpc-world-final-2021\/#Problem_H_Prehistoric_Programs\" title=\"Problem H. Prehistoric Programs\">Problem H. Prehistoric Programs<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-1'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/www.shuizilong.com\/house\/archives\/icpc-world-final-2021\/#Problem_A_Crystal_Crosswind\" title=\"Problem A. Crystal Crosswind\">Problem A. Crystal Crosswind<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-1'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/www.shuizilong.com\/house\/archives\/icpc-world-final-2021\/#Problem_L_Where_Am_I\" title=\"Problem L. Where Am I?\">Problem L. Where Am I?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-1'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/www.shuizilong.com\/house\/archives\/icpc-world-final-2021\/#Problem_I_Spider_Walk\" title=\"Problem I. Spider Walk\">Problem I. Spider Walk<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-1'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/www.shuizilong.com\/house\/archives\/icpc-world-final-2021\/#Problem_B_Dungeon_Crawler\" title=\"Problem B. Dungeon Crawler\">Problem B. Dungeon Crawler<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-1'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/www.shuizilong.com\/house\/archives\/icpc-world-final-2021\/#Problem_C_Fair_Division\" title=\"Problem C. Fair Division\">Problem C. Fair Division<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-1'><a class=\"ez-toc-link ez-toc-heading-8\" href=\"https:\/\/www.shuizilong.com\/house\/archives\/icpc-world-final-2021\/#Problem_G_Mosaic_Browsing\" title=\"Problem G. Mosaic Browsing\">Problem G. Mosaic Browsing<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-1'><a class=\"ez-toc-link ez-toc-heading-9\" href=\"https:\/\/www.shuizilong.com\/house\/archives\/icpc-world-final-2021\/#Problem_E\" title=\"Problem E.\">Problem E.<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-1'><a class=\"ez-toc-link ez-toc-heading-10\" href=\"https:\/\/www.shuizilong.com\/house\/archives\/icpc-world-final-2021\/#Problem_F_Islands_from_the_Sky\" title=\"Problem F. Islands from the Sky\">Problem F. Islands from the Sky<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-1'><a class=\"ez-toc-link ez-toc-heading-11\" href=\"https:\/\/www.shuizilong.com\/house\/archives\/icpc-world-final-2021\/#Problem_K_Take_On_Meme\" title=\"Problem K. Take On Meme\">Problem K. Take On Meme<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-1'><a class=\"ez-toc-link ez-toc-heading-12\" href=\"https:\/\/www.shuizilong.com\/house\/archives\/icpc-world-final-2021\/#Problem_D_Guardians_of_the_Gallery\" title=\"Problem D. Guardians of the Gallery\">Problem D. Guardians of the Gallery<\/a><\/li><\/ul><\/nav><\/div>\n\n<p>\u611f\u89c9\u4eca\u5e74\u9898\u76ee\u8c8c\u4f3c\u6bd4 <a href=\"https:\/\/www.shuizilong.com\/house\/archives\/icpc-world-final-2020\/\">\u53bb\u5e74<\/a> \u7b80\u5355\uff0c\u662f\u6211\u7684\u9519\u89c9\u5417\uff1f\uff08\u53cd\u6b63\u51e0\u4f55\u9898\u5927\u5bb6\u90fd\u4e0d\u4f1a\u53bb\u5f00\u7684\uff09\u3002<br \/>\n\u8fd8\u662f\u6309\u7167\u6211\u8ba4\u4e3a\u7684\u96be\u5ea6\u6392\u5e8f\u3002\u3002\u3002<\/p>\n<h1><span class=\"ez-toc-section\" id=\"Problem_H_Prehistoric_Programs\"><\/span>Problem H. Prehistoric Programs<span class=\"ez-toc-section-end\"><\/span><\/h1>\n<ul>\n<li><a href=\"https:\/\/acm.timus.ru\/problem.aspx?space=1&#038;num=1745\">https:\/\/acm.timus.ru\/problem.aspx?space=1&#038;num=1745<\/a><\/li>\n<li><a href=\"https:\/\/codeforces.com\/gym\/101341\/problem\/A\">https:\/\/codeforces.com\/gym\/101341\/problem\/A<\/a><\/li>\n<\/ul>\n<p>\u8d2a\u5fc3\u4e71\u641e\u3002<\/p>\n<h1><span class=\"ez-toc-section\" id=\"Problem_A_Crystal_Crosswind\"><\/span>Problem A. Crystal Crosswind<span class=\"ez-toc-section-end\"><\/span><\/h1>\n<p>\u6211\u4eec\u9700\u8981\u627e\u51fa\u5fc5\u987b\u662f &#8216;#&#8217; \u7684\u70b9\u548c\u5fc5\u987b\u662f &#8216;.&#8217; \u7684\u70b9\uff0c\u5269\u4e0b\u7684\u53ef\u4ee5\u968f\u4fbf\u586b\u3002<br \/>\n\u8003\u5bdf\u6bcf\u7ec4 wind \u80fd\u591f\u7ed9\u51fa\u7684\u4fe1\u606f\uff1a<br \/>\n(1): \u9996\u5148\u5bf9\u4e8e\u5176\u4e2d\u7684\u6bcf\u7ec4 (x, y) boundary\uff0c(x, y) \u5fc5\u7136\u586b &#8216;#&#8217;\uff0c\u4e14 (x &#8211; wx, y &#8211; wy) \u5fc5\u7136\u586b &#8216;.&#8217;\u3002<br \/>\n(2): \u9664\u6b64\u4e4b\u5916\uff0c\u5bf9\u4e8e\u6bcf\u4e2a\u4e0d\u5728 boundary \u7684\u70b9 (x, y)\uff0c\u4e5f\u662f\u80fd\u7ed9\u51fa\u4e00\u5b9a\u4fe1\u606f\u7684\uff08\u98ce\u5927\u6982\u8fd8\u6709\u4e2a z \u8f74\u4ece\u4e0a\u5411\u4e0b\u5439\u7684\u3002\u3002\uff09\uff0c\u8981\u4e48 (x, y) \u662f &#8216;.&#8217; \u8981\u4e48 (x, y) \u662f &#8216;#&#8217; \u4e14 (w &#8211; wx, y &#8211; wy) \u4e5f\u4e3a &#8216;#&#8217;\u3002<\/p>\n<p>\u5176\u5b9e\u5c31\u662f floodfill &#8230; \u5177\u4f53\u5b9e\u73b0\u7684\u65f6\u5019\uff0c\u5bf9\u4e8e\u7b2c\u4e00\u95ee\uff0c\u5148\u5047\u8bbe\u6240\u6709\u70b9\u90fd\u662f &#8216;.&#8217;\uff0c\u7136\u540e\u6839\u636e boundary \u4fe1\u606f\u7ed9\u51fa\u521d\u59cb\u7684 &#8216;#&#8217;\uff0c\u7136\u540e\u518d\u5bf9\u4e8e\u6bcf\u4e00\u4e2a\u65b0\u7684 &#8216;#&#8217;\uff0c\u7528\u7b2c\u4e8c\u4e2a\u6761\u4ef6\u53bb\u505a floodfill \u586b\u51fa\u5176\u5b83\u7684 &#8216;#&#8217;\u3002<br \/>\n\u7b2c\u4e8c\u95ee\u7684\u505a\u6cd5\u4e5f\u7c7b\u4f3c\uff0c\u8bb0\u5f97\u8fd8\u8981\u8003\u8651\u8fb9\u754c\u5916\u7684 &#8216;.&#8217;\u3002<\/p>\n<h1><span class=\"ez-toc-section\" id=\"Problem_L_Where_Am_I\"><\/span>Problem L. Where Am I?<span class=\"ez-toc-section-end\"><\/span><\/h1>\n<p>\u56e0\u4e3a\u6211\u4eec\u8981\u6c42\u548c\uff0c\u6240\u4ee5\u53ea\u80fd\u66b4\u529b bfs()\uff0c\u5c31\u662f\u548c\u524d\u51e0\u5929 CF \u7684\u90a3\u4e2a\u9898\u5dee\u4e0d\u591a\uff0c\u5f00\u4e24\u4e2a\u961f\u5217\u6765\u56de\u5012\u817e\uff0c\u628a\u6240\u6709\u6e90\u70b9\u5f04\u6210\u4e00\u4e2a\u96c6\u5408\u585e\u8fdb\u961f\u5217\u91cc\uff0c\u7136\u540e\u6bcf\u6b21\u79fb\u52a8\u4e00\u6b65\uff0c\u8fb9\u79fb\u52a8\u8fb9\u5206\u62c6\u96c6\u5408\uff0c\u76f4\u5230\u96c6\u5408\u4e2d\u53ea\u6709 1 \u4e2a\u5143\u7d20\uff0c\u590d\u6742\u5ea6 O(n4)\u3002<br \/>\n\u8003\u8651\u5230\u6807\u8bb0\u7684\u89c4\u6a21\u53ea\u6709 O(n)\uff0c\u6240\u4ee5\u53e6\u4e00\u79cd\u505a\u6cd5\u662f\uff0c\u6211\u4eec\u9884\u5904\u7406\u51fa\u6bcf\u4e2a\u70b9\uff0c\u5230\u6bcf\u4e2a\u6807\u8bb0\u7684\u8ddd\u79bb\uff0c\u5bf9\u8fd9\u4e9b\u8ddd\u79bb\u6309\u7167\u5b57\u5178\u5e8f\u6392\u5e8f\uff0c\u5c31\u53ef\u4ee5\u5f97\u5230\u6700\u65e9\u88ab\u5206\u5272\u7684\u65f6\u95f4\uff08\u7ed3\u6784\u7c7b\u4f3c\u540e\u7f00\u6811\u7ec4\uff09\uff0c\u590d\u6742\u5ea6 O(n3logn)\u3002<\/p>\n<h1><span class=\"ez-toc-section\" id=\"Problem_I_Spider_Walk\"><\/span>Problem I. Spider Walk<span class=\"ez-toc-section-end\"><\/span><\/h1>\n<p>I \u9898\u5f00\u59cb\u9898\u76ee\u8bfb\u9519\u4e86\u3002\u3002\u4ee5\u4e3a\u662f\u53ef\u4ee5\u82b1\u8d39 1 \u7684\u4ee3\u4ef7\u4fee bridge\uff0c\u7136\u540e\u6c42\u5355\u6e90\u6700\u77ed\u8def\u3002\u3002\u3002\u4f46\u662f\u5b9e\u9645\u4e0a\u5bf9\u4e8e\u6bcf\u4e00\u4e2a\u5f26\uff08bridge\uff09\u3002\u3002\u3002\u53ea\u8981\u9047\u5230\u4e86\uff0c\u5c31\u662f\u5fc5\u987b\u7ecf\u8fc7\u7684\u3002\u3002\u3002<br \/>\n\u90a3\u6700\u540e\u5c31\u662f\u5728\u8fd9\u4e2a\u4e1c\u897f\u4e0a\u9762 dp \u3002\u3002\u3002dp \u7684\u8fc7\u7a0b\u76f8\u5f53\u4e8e\uff0c\u4ece\u8fdc\u5230\u8fd1\uff0c\u6bcf\u6b21\u52a0\u4e00\u4e9b\u5f26\u3002\u3002\u7136\u540e\u7528\u8fd9\u4e9b\u5f26\u53bb\u505a\u677e\u5f1b\u3002\u3002\u3002\u6bcf\u6dfb\u52a0\u4e00\u6761\u8fb9\uff0c\u5b9e\u9645\u4e0a\u662f\u4ea4\u6362\u8fd9\u4e24\u4e2a\u70b9\u7684\u72b6\u6001\uff0c\u7136\u540e\u518d\u5206\u522b\u5411\u5de6\u548c\u5411\u53f3\u4e00\u8def\u626b\u4e0b\u53bb\u3002\u3002<\/p>\n<pre>\n2 3 3 2 1 0 1\n2 3 2 1 0 1 1\n1 2 2 1 0 1 2\n1 2 1 1 0 1 2\n2 1 1 1 0 1 2\n<\/pre>\n<p>\u4ee5\u6837\u4f8b 1 \u6765\u8bf4\u7684\u8bdd\u3002\u3002dp \u72b6\u6001\u662f\u8fd9\u6837\u3002\u3002\u8003\u5bdf\u7b2c\u4e00\u6761\u8fb9\u52a0\u5165\u4e4b\u540e\uff0c\u867d\u7136\u4ea4\u6362\u4e86 dp[4], dp[5] \u7684\u503c\uff0c\u4f46\u662f dp[6] \u4f9d\u7136\u7b49\u4e8e 1\uff0c\u56e0\u4e3a\u6211\u4eec\u518d\u540e\u7eed\u6dfb\u52a0\u8fb9\u65f6\uff0c\u53ef\u4ee5\u51b3\u5b9a\u6dfb\u52a0\u8fb9\u7684\u987a\u5e8f\u3002\u3002\u3002<br \/>\n\u6240\u4ee5\u6bcf\u4e2a\u72b6\u6001\u5728\u4efb\u610f\u65f6\u523b\uff0c\u9664\u4e86\u4ea4\u6362\u7684\u65f6\u5019\uff0cdp \u503c\u4e0d\u4f1a\u53d8\u52a3\uff0c\u786e\u5b9e\u7b26\u5408 \u201d\u677e\u5f1b\u201c \u7684\u4e00\u822c\u5b9a\u4e49\u3002\u3002\u3002<br \/>\n\u6700\u540e\u53ea\u8981\u52a8\u6001\u79bb\u6563\u5316\u538b\u7f29 dp \u72b6\u6001\u5373\u53ef\u3002\u3002\u3002<\/p>\n<h1><span class=\"ez-toc-section\" id=\"Problem_B_Dungeon_Crawler\"><\/span>Problem B. Dungeon Crawler<span class=\"ez-toc-section-end\"><\/span><\/h1>\n<p>\u6b63\u89e3\u8981\u500d\u589e\u7956\u5148 + dp\uff0c\u611f\u89c9\u975e\u5e38\u96be\u5199\u3002\u3002\u3002\u4f46\u662f\u8fd9\u4e2a\u9898\u53ef\u4ee5 O(nq) \u641e\u8fc7\u53bb\u56e7\uff08\u60f3\u4e0d\u5230\u5427\u3002\u3002\u3002<br \/>\n\u4e0d\u8fc7\u53bb\u5e74\u7684 B \u9898\u90fd\u80fd O(n2) \u7206\u8fc7\u53bb\u56e7\uff0c\u8fd9\u4e2a\u5f53\u7136\u4e5f\u4e0d\u7b97\u4ec0\u4e48\u3002\u3002\u3002\u3002<\/p>\n<h1><span class=\"ez-toc-section\" id=\"Problem_C_Fair_Division\"><\/span>Problem C. Fair Division<span class=\"ez-toc-section-end\"><\/span><\/h1>\n<p>\u521d\u59cb\u6709 m \u4ef7\u503c\u7684\u91d1\u5b50\uff0cn \u4e2a\u6d77\u76d7\u56f4\u6210\u4e00\u5708\uff0c\u6bcf\u6b21\u5f53\u524d\u91d1\u5b50\u7684 p\/q \u7559\u7ed9\u81ea\u5df1\uff0c\u5269\u4f59\u7684\u7ed9\u4e0b\u4e00\u4e2a\u4eba\uff0c\u8fd9\u4e2a\u8fc7\u7a0b\u5c06\u65e0\u9650\u8fdb\u884c\u4e0b\u53bb\u3002<br \/>\n\u95ee\u662f\u5426\u80fd\u627e\u5230\u5408\u6cd5\u7684 p, q \u4f7f\u5f97\u6bcf\u4e2a\u6d77\u76d7\u83b7\u5f97\u91d1\u5b50\u7684\u6781\u9650\u662f\u6574\u6570\uff08\u4e2d\u95f4\u53ef\u4ee5\u662f\u5206\u6570\uff09\u3002\u3002\u3002<\/p>\n<p>\u8c8c\u4f3c\u5f88\u4e45\u4ee5\u524d GCJ \u51fa\u8fc7\u4e00\u6b21\u6d77\u76d7\u5206\u91d1\u3002\u3002\u3002\u8fd9\u4e2a\u9898\u770b\u8d77\u6765\u63a8\u7406\u8fc7\u7a0b\u8981\u7b80\u5355\u4e00\u4e9b\u3002\u3002\u3002<br \/>\n\u57fa\u672c\u601d\u60f3\u662f\u5148\u5217\u51fa\u6bcf\u4e2a\u6d77\u76d7\u5206\u5f97\u9ec4\u91d1\u7684\u7b49\u5f0f\uff0c\u7528\u7b80\u5355\u7684\u6570\u8bba\u77e5\u8bc6\u627e\u5230\u5224\u522b\u5f0f\uff0c\u6700\u540e\u518d\u7528\u4e00\u4e9b\u4ee3\u6570\u6280\u5de7\u4f30\u8ba1 q \u7684\u4e0a\u754c\uff0c\u66b4\u529b\u679a\u4e3e\uff08\u6216\u8bb8\uff0c\u4f60\u4e5f\u53ef\u4ee5\u8df3\u8fc7\u8fd9\u4e2a\u6b65\u9aa4\u3002\u3002\u76f4\u63a5\u5361\u65f6\uff09\u3002<\/p>\n<p>$$\\begin{equation}<br \/>\n\\begin{split}<br \/>\n&amp; mf\\sum_{i=0}^\\infty r^i \\newline<br \/>\n&amp; r = (1 &#8211; f)^n \\newline<br \/>\n&amp; f = \\frac{p}{q} \\newline<br \/>\n\\end{split}<br \/>\n\\end{equation}$$<\/p>\n<p>$$\\begin{equation}<br \/>\n\\begin{split}<br \/>\nmf\\sum_{i=0}^\\infty r^i &amp; = \\frac{mf}{1-r} &#92;<br \/>\n &amp; = \\frac{mf}{1-(1-\\frac{p}{q})^n} &#92;<br \/>\n &amp; = \\frac{mf}{1-(\\frac{q-p}{q})^n} &#92;<br \/>\n &amp; = \\frac{mf}{(\\frac{q^n-(q-p)^n}{q^n})} &#92;<br \/>\n &amp; = \\frac{mfq^n}{q^n-(q-p)^n} &#92;<br \/>\n &amp; = \\frac{mpq^{n-1}}{q^n-(q-p)^n} &#92;<br \/>\n &amp; = \\frac{mpq^{n-1}}{q^n- \\sum_{i=0}^{n}q^i(-p)^{n-i}\\binom{n}{i}} &#92;<br \/>\n &amp; = \\frac{mpq^{n-1}}{\\sum_{i=0}^{n-1}q^i(-p)^{n-i}\\binom{n}{i}} &#92;<br \/>\n &amp; = \\frac{mq^{n-1}}{-\\sum_{i=0}^{n-1}q^i(-p)^{n-1-i}\\binom{n}{i}}<br \/>\n\\end{split}<br \/>\n\\end{equation}$$<\/p>\n<p>\u4e0a\u9762\u7684 q^{n-1} \u548c\u5206\u6bcd\u662f\u4e92\u7d20\u7684\uff0c\u56e0\u6b64\u5728\u5224\u5b9a\u6574\u9664\u65f6\u53ef\u4ee5\u76f4\u63a5\u5ffd\u7565\u3002<br \/>\n\u5177\u4f53\u6765\u8bf4\uff0c\u5982\u679c a, b \u4e92\u7d20\uff0c\u90a3\u4e48 a^n &#8211; b^n \u4e0e a \u548c b \u90fd\u4e92\u7d20\u3002\u8bc1\u660e\u53ef\u4ee5\u53cd\u8bc1\u6cd5\uff0c\u5047\u8bbe\u5b58\u5728\u7d20\u56e0\u5b50\uff0c\u63a8\u51fa a \u548c b \u4e0d\u4e92\u7d20\u5373\u53ef\u3002\u3002\u3002<br \/>\n\u5229\u7528\u8fd9\u4e2a\u7ed3\u8bba\uff0c\u4e0d\u4ec5\u53ef\u4ee5\u7b80\u5316\u5224\u522b\u5f0f\uff0c\u8fd8\u53ef\u4ee5\u53d1\u73b0\u4efb\u610f\u8003\u5bdf\u54ea\u4e2a\u6d77\u76d7\u90fd\u4e00\u6837\u3002\u3002\u3002\u3002<\/p>\n<p>\u4e0a\u5f0f\u8fd8\u53ef\u4ee5\u7ee7\u7eed\u4e8c\u9879\u5f0f\u5c55\u5f00\u3002\u3002\u3002<\/p>\n<p>$$\\begin{equation}<br \/>\n\\begin{split}<br \/>\n\\frac{mp}{q^n-(q-p)^n} &amp; = \\frac{mp}{q^n- \\sum_{i=0}^{n}q^i(-p)^{n-i}\\binom{n}{i}} &#92;<br \/>\n &amp; = \\frac{mp}{-\\sum_{i=0}^{n-1}q^i(-p)^{n-i}\\binom{n}{i}} &#92;<br \/>\n &amp; = \\frac{m}{\\sum_{i=0}^{n-1}q^i(-p)^{n-1-i}\\binom{n}{i}}<br \/>\n\\end{split}<br \/>\n\\end{equation}$$<\/p>\n<p>\u6211\u4eec\u53d1\u73b0\u4e0a\u9762\u7684 p \u56e0\u5b50\u4e5f\u53ef\u4ee5\u6d88\u53bb\u3002\u3002\u3002<br \/>\n\u8fdb\u4e00\u6b65\u6211\u4eec\u53ef\u4ee5\u4f7f\u7528\u4e0d\u7b49\u5f0f\u5bf9\u4e0a\u5f0f\u8fdb\u884c\u653e\u7f29\uff0c\u6216\u8005\u76f4\u63a5\u628a n \u6700\u5c0f\u7684\u60c5\u51b5\u5f80\u91cc\u9762\u4ee3\u5165\uff0c\u5f97\u5230 q \u7684\u4e0a\u754c\u5373\u53ef\u3002<br \/>\n\u5176\u5b9e\u6211\u89c9\u5f97\u8fd8\u662f\u633a\u96be\u7684\u56e7\u3002<\/p>\n<h1><span class=\"ez-toc-section\" id=\"Problem_G_Mosaic_Browsing\"><\/span>Problem G. Mosaic Browsing<span class=\"ez-toc-section-end\"><\/span><\/h1>\n<ul>\n<li><a href=\"https:\/\/www.luogu.com.cn\/problem\/P4173\">Luogu 4173. \u6b8b\u7f3a\u7684\u5b57\u7b26\u4e32<\/a><\/li>\n<\/ul>\n<p>\u7b97\u6cd5\u5bfc\u8bba\u544a\u8bc9\u6211\u4eec\uff0cRabin Karp \u7b97\u6cd5\u53ef\u4ee5\u975e\u5e38\u5bb9\u6613\u7684\u5c06\u5b57\u7b26\u4e32\u5339\u914d\u63a8\u5e7f\u5230\u77e9\u5f62\u4e0a\uff08\u5176\u5b9e\u5c31\u662f Hash \u4e71\u641e\uff09\uff0c\u4f46\u662f\u6211\u4eec\u5f88\u5feb\u53d1\u73b0\u6b64\u9898\u771f\u6b63\u8981\u5904\u7406\u7684\u96be\u70b9\u662f\u901a\u914d\u7b26\u3002<br \/>\n\u5b66\u4e60\u4e86\u4f8b\u9898\u4e4b\u540e\u6211\u4eec\u53d1\u73b0\u53ea\u8981\u7528 FFT \u5c31\u53ef\u4ee5\u6709\u6548\u7684\u89e3\u51b3\u8fd9\u4e2a\u95ee\u9898\u4e86~\uff01\u800c\u4e14\u53ea\u6709\u6a21\u5f0f\u4e32\u6709\u901a\u914d\u7b26\u3002\u3002\u5224\u522b\u5f0f\u8fd8\u8981\u66f4\u7b80\u5355\u4e00\u4e9b\u3002<\/p>\n<p>\u4f3c\u4e4e\u8fd8\u6709\u4e00\u79cd\u9ad8\u7ea7\u505a\u6cd5\u3002\u3002\u3002\u6211\u4e0d\u4f1a<br \/>\n&#8211; <a href=\"https:\/\/twitter.com\/heno_code\/status\/1590682021369884672\">https:\/\/twitter.com\/heno_code\/status\/1590682021369884672<\/a><\/p>\n<h1><span class=\"ez-toc-section\" id=\"Problem_E\"><\/span>Problem E.<span class=\"ez-toc-section-end\"><\/span><\/h1>\n<h1><span class=\"ez-toc-section\" id=\"Problem_F_Islands_from_the_Sky\"><\/span>Problem F. Islands from the Sky<span class=\"ez-toc-section-end\"><\/span><\/h1>\n<p>\u663e\u7136\u53ef\u4ee5\u4e8c\u5206\u7b54\u6848\uff0c\u66f4\u7b80\u5355\u7684\u505a\u6cd5\u662f\uff0c\u5bf9\u4e8e\u6bcf\u4e00\u6761\u822a\u7ebf\uff0c\u53bb\u66f4\u65b0\u6240\u6709\u591a\u8fb9\u5f62\u7684\u6700\u5c0f\u53ef\u884c\u89d2\u5ea6\uff0c\u6700\u540e\u518d\u53d6\u6700\u5927\u503c\u5373\u53ef\u3002<br \/>\n\u53ea\u9700\u8981\u5bf9\u591a\u8fb9\u5f62\u7684\u6bcf\u4e2a\u9876\u70b9\u505a\u5230\u822a\u7ebf\u7684\u6295\u5f71\uff0c\u7136\u540e\u53cd\u6b63\u5207\u51fd\u6570\u5373\u53ef\u3002<\/p>\n<h1><span class=\"ez-toc-section\" id=\"Problem_K_Take_On_Meme\"><\/span>Problem K. Take On Meme<span class=\"ez-toc-section-end\"><\/span><\/h1>\n<p>\u6700\u540e\u8fd8\u5269\u4e24\u9053\u51e0\u4f55\u9898\u3002\u3002\u3002Minkowski Addition + \u51f8\u5305\u4e71\u641e\u5373\u53ef\u3002<\/p>\n<h1><span class=\"ez-toc-section\" id=\"Problem_D_Guardians_of_the_Gallery\"><\/span>Problem D. Guardians of the Gallery<span class=\"ez-toc-section-end\"><\/span><\/h1>\n<p>OMG\uff0c\u6211\u4eec\u5148\u8981\u641e\u51fa\u591a\u8fb9\u5f62\u5185\u90e8\u53ef\u4ee5\u770b\u89c1\u76ee\u6807\u70b9\u7684\u533a\u57df\uff0c\u662f\u4e2a\u51f8\u591a\u8fb9\u5f62\uff0c\u7136\u540e\u53ea\u8981\u6c42\u70b9\u5230\u8fd9\u4e2a\u51f8\u591a\u8fb9\u5f62\u7684\u8ddd\u79bb\u5373\u53ef\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4f20\u9001\u95e8 \u63d0\u4ea4\u5730\u5740 \u524d\u60c5\u63d0\u8981 \u5b98\u65b9\u9898\u89e3 \u4ee3\u7801 \u611f\u89c9\u4eca\u5e74\u9898\u76ee\u8c8c\u4f3c\u6bd4 \u53bb\u5e74 \u7b80\u5355\uff0c\u662f\u6211\u7684\u9519\u89c9\u5417\uff1f\uff08\u53cd\u6b63\u51e0\u4f55\u9898\u5927\u5bb6\u90fd\u4e0d\u4f1a\u53bb\u5f00\u7684\uff09\u3002 \u8fd8\u662f\u6309\u7167\u6211\u8ba4\u4e3a\u7684\u96be\u5ea6\u6392\u5e8f\u3002\u3002\u3002 Problem H. Prehistoric Programs https:\/\/acm.timus.ru\/problem.aspx?space=1&#038;num=1745 https:\/\/codeforces.com\/gym\/101341\/problem\/A \u8d2a\u5fc3\u4e71\u641e\u3002 Problem A. Crystal Crosswind \u6211\u4eec\u9700\u8981\u627e\u51fa\u5fc5\u987b\u662f &#8216;#&#8217; \u7684\u70b9\u548c\u5fc5\u987b\u662f &#8216;.&#8217; \u7684\u70b9\uff0c\u5269\u4e0b\u7684\u53ef\u4ee5\u968f\u4fbf\u586b\u3002 \u8003\u5bdf\u6bcf\u7ec4 wind \u80fd\u591f\u7ed9\u51fa\u7684\u4fe1\u606f\uff1a (1): \u9996\u5148\u5bf9\u4e8e\u5176\u4e2d\u7684\u6bcf\u7ec4 (x, y) boundary\uff0c(x, y) \u5fc5\u7136\u586b &#8216;#&#8217;\uff0c\u4e14 (x &#8211; wx, y &#8211; wy) \u5fc5\u7136\u586b &#8216;.&#8217;\u3002 (2): \u9664\u6b64\u4e4b\u5916\uff0c\u5bf9\u4e8e\u6bcf\u4e2a\u4e0d\u5728 boundary \u7684\u70b9 (x, y)\uff0c\u4e5f\u662f\u80fd\u7ed9\u51fa\u4e00\u5b9a\u4fe1\u606f\u7684\uff08\u98ce\u5927\u6982\u8fd8\u6709\u4e2a z \u8f74\u4ece\u4e0a\u5411\u4e0b\u5439\u7684\u3002\u3002\uff09\uff0c\u8981\u4e48 (x, y) \u662f [&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-2043","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p2tdP7-wX","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.shuizilong.com\/house\/wp-json\/wp\/v2\/posts\/2043","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=2043"}],"version-history":[{"count":3,"href":"https:\/\/www.shuizilong.com\/house\/wp-json\/wp\/v2\/posts\/2043\/revisions"}],"predecessor-version":[{"id":2135,"href":"https:\/\/www.shuizilong.com\/house\/wp-json\/wp\/v2\/posts\/2043\/revisions\/2135"}],"wp:attachment":[{"href":"https:\/\/www.shuizilong.com\/house\/wp-json\/wp\/v2\/media?parent=2043"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.shuizilong.com\/house\/wp-json\/wp\/v2\/categories?post=2043"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.shuizilong.com\/house\/wp-json\/wp\/v2\/tags?post=2043"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}