{"id":3028,"date":"2023-06-14T03:34:19","date_gmt":"2023-06-13T19:34:19","guid":{"rendered":"https:\/\/www.shuizilong.com\/house\/?p=3028"},"modified":"2023-06-14T03:46:59","modified_gmt":"2023-06-13T19:46:59","slug":"luogu-p2053-scoi2007-%e4%bf%ae%e8%bd%a6","status":"publish","type":"post","link":"https:\/\/www.shuizilong.com\/house\/archives\/luogu-p2053-scoi2007-%e4%bf%ae%e8%bd%a6\/","title":{"rendered":"Luogu P2053. [SCOI2007] \u4fee\u8f66"},"content":{"rendered":"<ul>\n<li><a href=\"https:\/\/www.luogu.com.cn\/problem\/P2053\">https:\/\/www.luogu.com.cn\/problem\/P2053<\/a><br \/>\n\u770b\u8d77\u6765\u53ef\u4ee5 dp\uff0c\u4e0d\u8fc7\u6bcf\u4e2a\u4eba\u4fee\u6bcf\u4e2a\u8f66\u5730\u4ee3\u4ef7\u5e76\u4e0d\u76f8\u540c\u3002<br \/>\n\u4e8e\u662f\u53ef\u4ee5\u4e8c\u5206\u56fe\u5efa\u6a21\u3002<\/li>\n<\/ul>\n<pre class=\"brush: cpp; light: false; title: ; toolbar: true; notranslate\" title=\"\">\r\n#include &lt;lastweapon\/io&gt;\r\n#include &lt;lastweapon\/mincostflow&gt;\r\nusing namespace lastweapon;\r\n\r\nint main() {\r\n\r\n#ifndef ONLINE_JUDGE\r\n    freopen(&quot;in.txt&quot;, &quot;r&quot;, stdin);\r\n    \/\/freopen(&quot;out.txt&quot;, &quot;w&quot;, stdout);\r\n#endif\r\n\r\n    int m, n; RD(m, n); int s = n*(m+1), t = s+1;\r\n    mcf_graph&lt;int, int&gt; G(t+1);\r\n\r\n    REP(i, n) {\r\n        G.add_edge(s, i, 1, 0);\r\n        REP(j, m) {\r\n            G.add_edge(n*(j+1)+i, t, 1, 0);\r\n            int c; RD(c); REP(k, n) G.add_edge(i, n*(j+1)+k, 1, (k+1)*c);\r\n        }\r\n    }\r\n    printf(&quot;%.2f\\n&quot;, (DB)G.flow(s, t).se \/ n);\r\n}\r\n<\/pre>\n<pre class=\"brush: cpp; light: false; title: ; toolbar: true; notranslate\" title=\"\">\r\n#include &lt;lastweapon\/mincostflow2&gt;\r\nusing namespace lastweapon;\r\n\r\nint main() {\r\n\r\n#ifndef ONLINE_JUDGE\r\n    freopen(&quot;in.txt&quot;, &quot;r&quot;, stdin);\r\n    \/\/freopen(&quot;out.txt&quot;, &quot;w&quot;, stdout);\r\n#endif\r\n\r\n    int m, n; RD(m, n); int s = n*(m+1), t = s+1;\r\n    mcf_graph&lt;int, int, 2047, 105536, 2047&gt; G;\r\n    G.s = s; G.t = t; G.n = t+1;\r\n\r\n    REP(i, n) {\r\n        G.add_edge(s, i, 1, 0);\r\n        REP(j, m) {\r\n            G.add_edge(n*(j+1)+i, t, 1, 0);\r\n            int c; RD(c); REP(k, n) G.add_edge(i, n*(j+1)+k, 1, (k+1)*c);\r\n        }\r\n    }\r\n\r\n    printf(&quot;%.2f\\n&quot;, (DB)G.Run().se \/ n);\r\n}\r\n\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>https:\/\/www.luogu.com.cn\/problem\/P2053 \u770b\u8d77\u6765\u53ef\u4ee5 dp\uff0c\u4e0d\u8fc7\u6bcf\u4e2a\u4eba\u4fee\u6bcf\u4e2a\u8f66\u5730\u4ee3\u4ef7\u5e76\u4e0d\u76f8\u540c\u3002 \u4e8e\u662f\u53ef\u4ee5\u4e8c\u5206\u56fe\u5efa\u6a21\u3002 #include &lt;lastweapon\/io&gt; #include &lt;lastweapon\/mincostflow&gt; using namespace lastweapon; int main() { #ifndef ONLINE_JUDGE freopen(&quot;in.txt&quot;, &quot;r&quot;, stdin); \/\/freopen(&quot;out.txt&quot;, &quot;w&quot;, stdout); #endif int m, n; RD(m, n); int s = n*(m+1), t = s+1; mcf_graph&lt;int, int&gt; G(t+1); REP(i, n) { G.add_edge(s, i, 1, 0); REP(j, m) { G.add_edge(n*(j+1)+i, t, 1, 0); int c; RD(c); [&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-3028","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p2tdP7-MQ","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.shuizilong.com\/house\/wp-json\/wp\/v2\/posts\/3028","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=3028"}],"version-history":[{"count":3,"href":"https:\/\/www.shuizilong.com\/house\/wp-json\/wp\/v2\/posts\/3028\/revisions"}],"predecessor-version":[{"id":3031,"href":"https:\/\/www.shuizilong.com\/house\/wp-json\/wp\/v2\/posts\/3028\/revisions\/3031"}],"wp:attachment":[{"href":"https:\/\/www.shuizilong.com\/house\/wp-json\/wp\/v2\/media?parent=3028"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.shuizilong.com\/house\/wp-json\/wp\/v2\/categories?post=3028"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.shuizilong.com\/house\/wp-json\/wp\/v2\/tags?post=3028"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}