{"id":2855,"date":"2023-05-19T22:13:37","date_gmt":"2023-05-19T14:13:37","guid":{"rendered":"https:\/\/www.shuizilong.com\/house\/?p=2855"},"modified":"2023-05-20T02:21:49","modified_gmt":"2023-05-19T18:21:49","slug":"luogu-p6295-%e6%9c%89%e6%a0%87%e5%8f%b7-dag-%e8%ae%a1%e6%95%b0","status":"publish","type":"post","link":"https:\/\/www.shuizilong.com\/house\/archives\/luogu-p6295-%e6%9c%89%e6%a0%87%e5%8f%b7-dag-%e8%ae%a1%e6%95%b0\/","title":{"rendered":"Luogu P6295. \u6709\u6807\u53f7 DAG \u8ba1\u6570"},"content":{"rendered":"<p>\u5bf9\u4e8e\u6709\u6807\u53f7\u56fe\uff0c\u5047\u8bbe\u6211\u4eec\u5f97\u5230\u4e86\u4e0d\u8fde\u901a\u60c5\u51b5\u4e0b\u7684 EGF\uff0c\u90a3\u4e48\u6c42\u5bf9\u5e94\u7684\u8fde\u901a\u56fe\u6709\u5e38\u89c1\u5957\u8def\uff08\u53ef\u53c2\u89c1 <a href=\"https:\/\/www.shuizilong.com\/house\/archives\/luogu-p4841-%e9%9b%86%e8%ae%ad%e9%98%9f%e4%bd%9c%e4%b8%9a2013%e5%9f%8e%e5%b8%82%e8%a7%84%e5%88%92\/\">\u57ce\u5e02\u89c4\u5212\u90a3\u4e2a\u9898<\/a> \u548c <a href=\"\">\u8352\u6f20\u90a3\u4e2a\u9898<\/a>\uff09\u3002<\/p>\n<p>\u56e0\u800c\u95ee\u9898\u8f6c\u6362\u4e3a\u4e0d\u8fde\u901a\u7684\u60c5\u51b5\uff0c\u4e5f\u5c31\u662f <a href=\"https:\/\/www.shuizilong.com\/house\/archives\/bzoj-2863-%e6%84%a4%e6%80%92%e7%9a%84%e5%85%83%e9%a6%96\/\">\u4e0a\u4e00\u9898<\/a>\u3002<\/p>\n<p>\u6211\u4eec\u9700\u8981\u5148\u60f3\u529e\u6cd5\u6784\u9020\u5377\u79ef\u3002<\/p>\n<p class=\"ql-center-displayed-equation\" style=\"line-height: 57px;\"><span class=\"ql-right-eqno\"> (1) <\/span><span class=\"ql-left-eqno\"> &nbsp; <\/span><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.shuizilong.com\/house\/wp-content\/ql-cache\/quicklatex.com-ad0b0f85cefcc3c1b9e826487a2a58bb_l3.png\" height=\"57\" width=\"268\" class=\"ql-img-displayed-equation quicklatex-auto-format\" alt=\"&#92;&#98;&#101;&#103;&#105;&#110;&#123;&#97;&#108;&#105;&#103;&#110;&#42;&#125; &#102;&#95;&#105;&#32;&#38;&#61;&#32;&#92;&#115;&#117;&#109;&#95;&#123;&#106;&#61;&#49;&#125;&#94;&#123;&#105;&#125;&#32;&#40;&#45;&#49;&#41;&#94;&#123;&#106;&#45;&#49;&#125;&#32;&#92;&#98;&#105;&#110;&#111;&#109;&#123;&#105;&#125;&#123;&#106;&#125;&#32;&#92;&#115;&#117;&#109;&#95;&#123;&#107;&#61;&#49;&#125;&#94;&#123;&#105;&#45;&#106;&#125;&#32;&#102;&#95;&#123;&#105;&#45;&#106;&#125;&#32;&#50;&#94;&#123;&#106;&#40;&#105;&#45;&#106;&#41;&#125; &#92;&#101;&#110;&#100;&#123;&#97;&#108;&#105;&#103;&#110;&#42;&#125;\" title=\"Rendered by QuickLaTeX.com\"\/><\/p>\n<p>\u8fd9\u91cc\u9700\u8981\u7528\u4e00\u4e9b trick\uff0c\u6700\u540e\u5f97\u5230\u3002<\/p>\n<p class=\"ql-center-displayed-equation\" style=\"line-height: 102px;\"><span class=\"ql-right-eqno\"> (2) <\/span><span class=\"ql-left-eqno\"> &nbsp; <\/span><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.shuizilong.com\/house\/wp-content\/ql-cache\/quicklatex.com-22eefde64b9d0c5c88591b61dbec3b04_l3.png\" height=\"102\" width=\"168\" class=\"ql-img-displayed-equation quicklatex-auto-format\" alt=\"&#92;&#98;&#101;&#103;&#105;&#110;&#123;&#97;&#108;&#105;&#103;&#110;&#42;&#125; &#70;&#40;&#120;&#41;&#32;&#38;&#61;&#32;&#92;&#115;&#117;&#109;&#95;&#123;&#105;&#125;&#32;&#120;&#94;&#105;&#32;&#92;&#102;&#114;&#97;&#99;&#123;&#102;&#95;&#105;&#125;&#123;&#105;&#33;&#50;&#94;&#92;&#98;&#105;&#110;&#111;&#109;&#123;&#105;&#125;&#123;&#50;&#125;&#125;&#32;&#92;&#92; &#71;&#40;&#120;&#41;&#32;&#38;&#61;&#32;&#92;&#115;&#117;&#109;&#95;&#123;&#105;&#125;&#32;&#120;&#94;&#105;&#32;&#92;&#102;&#114;&#97;&#99;&#123;&#40;&#45;&#49;&#41;&#94;&#123;&#105;&#43;&#49;&#125;&#125;&#123;&#105;&#33;&#50;&#94;&#92;&#98;&#105;&#110;&#111;&#109;&#123;&#105;&#125;&#123;&#50;&#125;&#125;&#32; &#92;&#101;&#110;&#100;&#123;&#97;&#108;&#105;&#103;&#110;&#42;&#125;\" title=\"Rendered by QuickLaTeX.com\"\/><\/p>\n<pre class=\"brush: cpp; light: false; title: ; toolbar: true; notranslate\" title=\"\">\r\n#include &lt;lastweapon\/poly&gt;\r\n#include &lt;lastweapon\/number&gt;\r\nusing namespace lastweapon;\r\n\r\nLL C2(LL n) {\r\n    return n*(n-1)\/2;\r\n}\r\n\r\nint main() {\r\n#ifndef ONLINE_JUDGE\r\n    \/\/freopen(&quot;in.txt&quot;, &quot;r&quot;, stdin);\r\n#endif\r\n    int n; RD(n)++;\r\n\r\n    Poly F(n); Mint i2 = invFac&#x5B;2];\r\n\r\n    FOR(i, 1, n) {\r\n        F&#x5B;i] = invFac&#x5B;i] * pow(i2, C2(i));\r\n        if (i&amp;1) F&#x5B;i] = -F&#x5B;i];\r\n    }\r\n\r\n    F&#x5B;0] += 1; F = F.inv(n);\r\n    REP_1(i, n) F&#x5B;i] *= pow(Mint(2), C2(i));\r\n    F = F.log(n);\r\n\r\n    --n;\r\n    REP_1(i, n) {\r\n        cout &lt;&lt; F&#x5B;i] * fac&#x5B;i] &lt;&lt; endl;\r\n    }\r\n}\r\n\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u5bf9\u4e8e\u6709\u6807\u53f7\u56fe\uff0c\u5047\u8bbe\u6211\u4eec\u5f97\u5230\u4e86\u4e0d\u8fde\u901a\u60c5\u51b5\u4e0b\u7684 EGF\uff0c\u90a3\u4e48\u6c42\u5bf9\u5e94\u7684\u8fde\u901a\u56fe\u6709\u5e38\u89c1\u5957\u8def\uff08\u53ef\u53c2\u89c1 \u57ce\u5e02\u89c4\u5212\u90a3\u4e2a\u9898 \u548c \u8352\u6f20\u90a3\u4e2a\u9898\uff09\u3002 \u56e0\u800c\u95ee\u9898\u8f6c\u6362\u4e3a\u4e0d\u8fde\u901a\u7684\u60c5\u51b5\uff0c\u4e5f\u5c31\u662f \u4e0a\u4e00\u9898\u3002 \u6211\u4eec\u9700\u8981\u5148\u60f3\u529e\u6cd5\u6784\u9020\u5377\u79ef\u3002 (1) &nbsp; \u8fd9\u91cc\u9700\u8981\u7528\u4e00\u4e9b trick\uff0c\u6700\u540e\u5f97\u5230\u3002 (2) &nbsp; #include &lt;lastweapon\/poly&gt; #include &lt;lastweapon\/number&gt; using namespace lastweapon; LL C2(LL n) { return n*(n-1)\/2; } int main() { #ifndef ONLINE_JUDGE \/\/freopen(&quot;in.txt&quot;, &quot;r&quot;, stdin); #endif int n; RD(n)++; Poly F(n); Mint i2 = invFac&#x5B;2]; FOR(i, 1, n) { F&#x5B;i] = invFac&#x5B;i] * pow(i2, [&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-2855","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p2tdP7-K3","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.shuizilong.com\/house\/wp-json\/wp\/v2\/posts\/2855","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=2855"}],"version-history":[{"count":14,"href":"https:\/\/www.shuizilong.com\/house\/wp-json\/wp\/v2\/posts\/2855\/revisions"}],"predecessor-version":[{"id":2869,"href":"https:\/\/www.shuizilong.com\/house\/wp-json\/wp\/v2\/posts\/2855\/revisions\/2869"}],"wp:attachment":[{"href":"https:\/\/www.shuizilong.com\/house\/wp-json\/wp\/v2\/media?parent=2855"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.shuizilong.com\/house\/wp-json\/wp\/v2\/categories?post=2855"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.shuizilong.com\/house\/wp-json\/wp\/v2\/tags?post=2855"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}