{"id":2877,"date":"2023-05-23T23:33:55","date_gmt":"2023-05-23T15:33:55","guid":{"rendered":"https:\/\/www.shuizilong.com\/house\/?p=2877"},"modified":"2023-05-23T23:38:39","modified_gmt":"2023-05-23T15:38:39","slug":"atcoder-beginner-contest-284","status":"publish","type":"post","link":"https:\/\/www.shuizilong.com\/house\/archives\/atcoder-beginner-contest-284\/","title":{"rendered":"AtCoder Beginner Contest 284"},"content":{"rendered":"<h2>Ex. Count Unlabeled Graphs<\/h2>\n<p>k = 1 \u7684\u60c5\u51b5\u4e0b\uff0c\u663e\u7136\u5c31\u662f\u65e0\u6807\u53f7\u56fe\u8ba1\u6570\u3002<br \/>\n\u6240\u4ee5\u505a\u6cd5\u4e5f\u5fc5\u7136\u4e0d\u4f1a\u5f31\u4e8e <a href=\"https:\/\/www.shuizilong.com\/house\/archives\/sgu-282-isomorphism\/\">\u539f\u9898<\/a>\u3002<\/p>\n<p>\u56de\u5fc6\u539f\u9898\u4e2d\uff0c\u6211\u4eec\u5bf9\u70b9\u96c6\u7684\u5bf9\u79f0\u7fa4\uff0c\u6309\u7167 cycle index \u8fdb\u884c\u5206\u7c7b\uff0c\u518d\u53bb\u751f\u6210\u5bf9\u5e94\u7684\u8fb9\u7f6e\u6362\u7fa4\uff0c\u518d\u5f97\u5230\u8fb9\u7f6e\u6362\u7fa4\u7684 cycle index\u3002\u4e0d\u8fc7\u770b\u8d77\u6765\u8fd9\u91cc\u6211\u4eec\u65e2\u8981\u8003\u8651\u8fb9\u67d3\u8272\uff0c\u8fd8\u8981\u8003\u8651\u70b9\u67d3\u8272\uff0c\u597d\u5728\u5b83\u4eec\u7684\u7ed3\u6784\u90fd\u662f\u7528\u521d\u59cb\u7684\u70b9\u7fa4\u7684 cycle index \u6240\u51b3\u5b9a\u7684\uff0c\u53ef\u4ee5\u4e00\u8d77\u53c2\u4e0e\u8ba1\u7b97\u3002<\/p>\n<p>\u6700\u540e\u518d <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\/\">\u7b80\u5355\u5197\u65a5<\/a> \u4e00\u4e0b\u5373\u53ef\u3002<\/p>\n<pre class=\"brush: cpp; light: false; title: ; toolbar: true; notranslate\" title=\"\">\r\n#include &lt;lastweapon\/number&gt;\r\n\r\nusing namespace lastweapon;\r\n\r\nconst int N = int(5e1) + 9;\r\nInt Fact&#x5B;N]; VVI Partition; VI cur;\r\nint n;\r\n\r\nvoid gen(int n = ::n, int s = 1){\r\n    if (!n){\r\n        Partition.PB(cur);\r\n    }\r\n    else if (n &gt;= s){\r\n        cur.PB(s); gen(n-s, s); cur.pop_back();\r\n        gen(n, s+1);\r\n    }\r\n}\r\n\r\nInt c(const VI P){\r\n\r\n    Int z = Fact&#x5B;n]; int c = 0, l = P.front();\r\n\r\n    ECH(it, P){\r\n        z \/= *it; if (*it != l){\r\n            z \/= Fact&#x5B;c]; l = *it;\r\n            c = 1;\r\n        }\r\n        else{\r\n            ++c;\r\n        }\r\n    }\r\n\r\n    z \/= Fact&#x5B;c];\r\n    return z;\r\n}\r\n\r\nint g(const VI P){\r\n\r\n    REP(i, SZ(P)) {\r\n        w&#x5B;i] = 0; vis&#x5B;i] = 0;\r\n        adj&#x5B;i].clear();\r\n    }\r\n\r\n    int z = 0; REP(i, SZ(P)){\r\n        z += P&#x5B;i] \/ 2;\r\n        REP(j, i) z += __gcd(P&#x5B;i], P&#x5B;j]);\r\n    }\r\n    return z;\r\n}\r\n\r\nInt binom(int n, int m) {\r\n    return Fact&#x5B;n] \/ (Fact&#x5B;m] * Fact&#x5B;n-m]);\r\n}\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 k; RD(n, k, MOD); Fact&#x5B;0] = 1; REP_1(i, n) Fact&#x5B;i] = Fact&#x5B;i-1] * i;\r\n\r\n    gen();\r\n\r\n    Int z = 0; ECH(it, Partition) if (SZ(*it) &gt;= k) {\r\n        Int zz = 0;\r\n        REP(i, k) {\r\n            Int d = binom(k, i) * pow(Int(k-i), SZ(*it));\r\n            if (i&amp;1) zz -= d; else zz += d;\r\n        }\r\n        z += zz * c(*it) * pow(Int(2), g(*it));\r\n    }\r\n    z \/= Fact&#x5B;n];\r\n    cout &lt;&lt; z &lt;&lt; endl;\r\n}\r\n\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Ex. Count Unlabeled Graphs k = 1 \u7684\u60c5\u51b5\u4e0b\uff0c\u663e\u7136\u5c31\u662f\u65e0\u6807\u53f7\u56fe\u8ba1\u6570\u3002 \u6240\u4ee5\u505a\u6cd5\u4e5f\u5fc5\u7136\u4e0d\u4f1a\u5f31\u4e8e \u539f\u9898\u3002 \u56de\u5fc6\u539f\u9898\u4e2d\uff0c\u6211\u4eec\u5bf9\u70b9\u96c6\u7684\u5bf9\u79f0\u7fa4\uff0c\u6309\u7167 cycle index \u8fdb\u884c\u5206\u7c7b\uff0c\u518d\u53bb\u751f\u6210\u5bf9\u5e94\u7684\u8fb9\u7f6e\u6362\u7fa4\uff0c\u518d\u5f97\u5230\u8fb9\u7f6e\u6362\u7fa4\u7684 cycle index\u3002\u4e0d\u8fc7\u770b\u8d77\u6765\u8fd9\u91cc\u6211\u4eec\u65e2\u8981\u8003\u8651\u8fb9\u67d3\u8272\uff0c\u8fd8\u8981\u8003\u8651\u70b9\u67d3\u8272\uff0c\u597d\u5728\u5b83\u4eec\u7684\u7ed3\u6784\u90fd\u662f\u7528\u521d\u59cb\u7684\u70b9\u7fa4\u7684 cycle index \u6240\u51b3\u5b9a\u7684\uff0c\u53ef\u4ee5\u4e00\u8d77\u53c2\u4e0e\u8ba1\u7b97\u3002 \u6700\u540e\u518d \u7b80\u5355\u5197\u65a5 \u4e00\u4e0b\u5373\u53ef\u3002 #include &lt;lastweapon\/number&gt; using namespace lastweapon; const int N = int(5e1) + 9; Int Fact&#x5B;N]; VVI Partition; VI cur; int n; void gen(int n = ::n, int s = 1){ if (!n){ Partition.PB(cur); } [&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-2877","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p2tdP7-Kp","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.shuizilong.com\/house\/wp-json\/wp\/v2\/posts\/2877","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=2877"}],"version-history":[{"count":5,"href":"https:\/\/www.shuizilong.com\/house\/wp-json\/wp\/v2\/posts\/2877\/revisions"}],"predecessor-version":[{"id":2882,"href":"https:\/\/www.shuizilong.com\/house\/wp-json\/wp\/v2\/posts\/2877\/revisions\/2882"}],"wp:attachment":[{"href":"https:\/\/www.shuizilong.com\/house\/wp-json\/wp\/v2\/media?parent=2877"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.shuizilong.com\/house\/wp-json\/wp\/v2\/categories?post=2877"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.shuizilong.com\/house\/wp-json\/wp\/v2\/tags?post=2877"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}