{"id":159,"date":"2026-05-16T11:23:19","date_gmt":"2026-05-16T03:23:19","guid":{"rendered":"https:\/\/huxiaole.cloud\/?p=159"},"modified":"2026-05-16T11:25:53","modified_gmt":"2026-05-16T03:25:53","slug":"atcoder-beginner-contest-441-promotion-of-engineer-guild-fesd%e9%a2%98","status":"publish","type":"post","link":"https:\/\/huxiaole.cloud\/index.php\/2026\/05\/16\/atcoder-beginner-contest-441-promotion-of-engineer-guild-fesd%e9%a2%98\/","title":{"rendered":"AtCoder Beginner Contest 441 (Promotion of Engineer Guild Fes)D\u9898"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">\u7ed9\u5b9a\u4e00\u4e2a\u5305\u542b N \u4e2a\u9876\u70b9\u548c M \u6761\u8fb9\u7684\u6709\u5411\u56fe\uff08\u4e0d\u4e00\u5b9a\u662f\u7b80\u5355\u56fe\uff09\uff0c\u9876\u70b9\u7f16\u53f7\u4e3a 1, 2, \\dots, N\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u7b2c i \u6761\u8fb9 (1 \\le i \\le M) \u4ece\u9876\u70b9 U_i \u6307\u5411\u9876\u70b9 V_i\uff0c\u5176\u82b1\u8d39\uff08\u6743\u503c\uff09\u4e3a C_i\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u6b64\u5916\uff0c\u56fe\u4e2d\u6bcf\u4e2a\u9876\u70b9\u7684\u51fa\u5ea6\u6700\u591a\u4e3a 4\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u8bf7\u627e\u51fa\u6240\u6709\u6ee1\u8db3\u4ee5\u4e0b\u6761\u4ef6\u7684\u9876\u70b9 v (1 \\le v \\le N)\uff1a<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u4ece\u9876\u70b9 1 \u5230\u9876\u70b9 v \u5b58\u5728\u4e00\u6761\u8def\u5f84\uff0c\u540c\u65f6\u6ee1\u8db3\u4ee5\u4e0b\u4e24\u4e2a\u6761\u4ef6\uff1a<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>\u8be5\u8def\u5f84<strong>\u6070\u597d<\/strong>\u7ecf\u8fc7 L \u6761\u8fb9\u3002\uff08\u5982\u679c\u540c\u4e00\u6761\u8fb9\u88ab\u7ecf\u8fc7\u591a\u6b21\uff0c\u5219\u6bcf\u6b21\u7ecf\u8fc7\u90fd\u8981\u8ba1\u7b97\u5728\u5185\u3002\uff09<\/li>\n\n\n\n<li>\u8def\u5f84\u4e0a\u7ecf\u8fc7\u7684\u8fb9\u7684\u82b1\u8d39\u4e4b\u548c<strong>\u81f3\u5c11\u4e3a S \u4e14\u81f3\u591a\u4e3a T<\/strong>\u3002\uff08\u5982\u679c\u540c\u4e00\u6761\u8fb9\u88ab\u7ecf\u8fc7\u591a\u6b21\uff0c\u5176\u82b1\u8d39\u6bcf\u6b21\u90fd\u8981\u7d2f\u52a0\u3002\uff09<\/li>\n<\/ol>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>\u4ec0\u4e48\u662f\u51fa\u5ea6\uff1f<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">\u9876\u70b9 u \u7684\u51fa\u5ea6\u662f\u6307\u4ece\u9876\u70b9 u \u51fa\u53d1\u7684\u8fb9\u7684\u6570\u91cf\u3002\u5373\u4f7f\u6709\u591a\u6761\u8fb9\u6307\u5411\u540c\u4e00\u4e2a\u9876\u70b9\uff0c\u5b83\u4eec\u4e5f\u662f\u5206\u522b\u8ba1\u7b97\u7684\u3002<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>\u7ea6\u675f\u6761\u4ef6<\/strong><\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li>1 \\le N \\le 2 \\times 10^5<br><\/li>\n\n\n\n<li>1 \\le M \\le 2 \\times 10^5<br><\/li>\n\n\n\n<li>1 \\le L \\le 10<br><\/li>\n\n\n\n<li>1 \\le S \\le T \\le 10^9<br><\/li>\n\n\n\n<li>1 \\le U_i, V_i \\le N<br><\/li>\n\n\n\n<li>1 \\le C_i \\le 10^8<br><\/li>\n\n\n\n<li>\u6bcf\u4e2a\u9876\u70b9\u7684\u51fa\u5ea6\u6700\u591a\u4e3a 4\u3002<br><\/li>\n\n\n\n<li>\u6240\u6709\u8f93\u5165\u6570\u503c\u5747\u4e3a\u6574\u6570\u3002<br><\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>\u8f93\u5165<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">\u8f93\u5165\u7531\u6807\u51c6\u8f93\u5165\u7ed9\u51fa\uff0c\u683c\u5f0f\u5982\u4e0b\uff1a<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">N \\ M \\ L \\ S \\ T<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">U_1 \\ V_1 \\ C_1<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">U_2 \\ V_2 \\ C_2<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\\vdots<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">U_M \\ V_M \\ C_M<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>\u8f93\u51fa<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">\u6309\u5347\u5e8f\u6253\u5370\u6240\u6709\u6ee1\u8db3\u6761\u4ef6\u7684\u9876\u70b9\u7f16\u53f7\uff0c\u4e2d\u95f4\u7528\u7a7a\u683c\u5206\u9694\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u5982\u679c\u6ca1\u6709\u9876\u70b9\u6ee1\u8db3\u6761\u4ef6\uff0c\u8bf7\u6253\u5370\u4e00\u4e2a\u7a7a\u884c\u3002<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>\u6837\u4f8b 1 \u89e3\u91ca<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">\u7ed9\u5b9a\u7684\u56fe\u5982\u5de6\u4e0b\u89d2\u6240\u793a\u3002\u6bcf\u6761\u8fb9\u7684\u82b1\u8d39\u6807\u6ce8\u5728\u8be5\u8fb9\u7684\u8d77\u70b9\u9644\u8fd1\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u5728\u6b64\u4f8b\u4e2d\uff0c\u60c5\u51b5\u5982\u4e0b\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>\u5173\u4e8e\u9876\u70b9 1\uff1a<\/strong> \u8003\u8651\u8def\u5f84 1 \\to 2 \\to 5 \\to 1\u3002\u8fd9\u6761\u8def\u5f84\u6070\u597d\u7ecf\u8fc7 3 \u6761\u8fb9\uff0c\u603b\u82b1\u8d39\u4e3a 20+10+70=100\uff0c\u5728 [80, 100] \u8303\u56f4\u5185\uff0c\u56e0\u6b64\u6ee1\u8db3\u6761\u4ef6\u3002<br><\/li>\n\n\n\n<li><strong>\u5173\u4e8e\u9876\u70b9 2\uff1a<\/strong> \u4ece\u9876\u70b9 1 \u5230\u9876\u70b9 2 \u4e0d\u5b58\u5728\u6ee1\u8db3\u6761\u4ef6\u7684\u8def\u5f84\u3002\u4f8b\u5982\u8def\u5f84 1 \\to 2 \\to 1 \\to 2 \u867d\u7136\u7ecf\u8fc7 3 \u6761\u8fb9\uff0c\u4f46\u82b1\u8d39\u4e3a 20+30+20=70\uff0c\u5c0f\u4e8e 80\uff0c\u4e0d\u6ee1\u8db3\u6761\u4ef6\u3002<br><\/li>\n\n\n\n<li><strong>\u5173\u4e8e\u9876\u70b9 3\uff1a<\/strong> \u8def\u5f84 1 \\to 2 \\to 1 \\to 3 \u7ecf\u8fc7 3 \u6761\u8fb9\uff0c\u4f46\u82b1\u8d39\u4e3a 20+30+70=120\uff0c\u5927\u4e8e 100\uff0c\u4e0d\u6ee1\u8db3\u6761\u4ef6\u3002<br><\/li>\n\n\n\n<li><strong>\u5173\u4e8e\u9876\u70b9 5\uff1a<\/strong> \u8003\u8651\u8def\u5f84 1 \\to 3 \\to 2 \\to 5\u3002\u8fd9\u6761\u8def\u5f84\u6070\u597d\u7ecf\u8fc7 3 \u6761\u8fb9\uff0c\u603b\u82b1\u8d39\u4e3a 70+10+10=90\uff0c\u5728 [80, 100] \u8303\u56f4\u5185\uff0c\u6ee1\u8db3\u6761\u4ef6\u3002<br><\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">\u56e0\u6b64\uff0c\u6309\u5347\u5e8f\u8f93\u51fa <code>1 5<\/code>\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>\u6837\u4f8b 3 \u63d0\u793a<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">\u56fe\u53ef\u80fd\u5305\u542b\u81ea\u73af\uff08\u4ece\u81ea\u5df1\u6307\u5411\u81ea\u5df1\u7684\u8fb9\uff09\u548c\u91cd\u8fb9\uff08\u591a\u6761\u8fb9\u8fde\u63a5\u76f8\u540c\u7684\u4e24\u4e2a\u70b9\uff09\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u5728\u8fd9\u4e2a\u6d4b\u8bd5\u7528\u4f8b\u4e2d\uff0c\u9876\u70b9 1 \u7684\u51fa\u5ea6\u4e3a 4\uff0c\u9876\u70b9 2 \u7684\u51fa\u5ea6\u4e3a 1\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u601d\u8def<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">\u7531\u4e8e\u8def\u5f84\u5c0f\u4e8e10\uff0c\u4e14\u6bcf\u4e2a\u70b9\u7684\u51fa\u5ea6\u4e3a4\uff0c\u6240\u4ee5\u81f3\u591a4^{10} = (2^2)^{10} = 2^{20} \\approx 1,000,000\u56e0\u6b64\u76f4\u63a5DFS\uff0c\u65b9\u6848\u53ef\u884c\u5c31\u6807\u8bb0\uff0c\u4ece1\u51fa\u53d1\uff0c\u957f\u5ea6\u8d85\u8fc7\u6216\u8005\u6df1\u5ea6\u8d85\u8fc7\u8fd4\u56de\uff0c\u957f\u5ea6\u7b49\u4e8e\u5c31\u770b\u770b\u7b26\u5408\u4e0d\u7b26\u5408\uff0c\u957f\u5ea6\u5c0f\u4e8e\u5c31\u6807\u8bb0\uff0c\u6700\u540e\u7edf\u4e00\u8f93\u51fa<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u4ee3\u7801<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>\/\/ Sunshine sunshine ladybugs awake,\n\n\/\/ Clap your hooves and do a little shake.\n\n#ifdef _GLIBCXX_DEBUG\n\n#undef _GLIBCXX_DEBUG\n\n#endif\n\n#ifdef _GLIBCXX_DEBUG_PEDANTIC\n\n#undef _GLIBCXX_DEBUG_PEDANTIC\n\n#endif\n\n#include &lt;bits\/stdc++.h&gt;\n\n#define int long long\n\nusing namespace std;\n\n  \n\nconst int MAXN=2000010;\n\nstruct Node{\n\n&nbsp; &nbsp; int to,cost;\n\n};\n\nvector&lt;Node&gt; adj&#91;MAXN];\n\nint vis&#91;MAXN];\n\nint n,m,l,s,t;\n\n  \n\nvoid DFS(int u,int d,int len){\n\n&nbsp; &nbsp; if(d&gt;l||len&gt;t)return ;\n\n&nbsp; &nbsp; if(d==l&amp;&amp;len&gt;=s&amp;&amp;len&lt;=t){\n\n&nbsp; &nbsp; &nbsp; &nbsp; vis&#91;u]=true;\n\n&nbsp; &nbsp; &nbsp; &nbsp; return ;\n\n&nbsp; &nbsp; }\n\n&nbsp; &nbsp; for(auto &#91;to,cost]:adj&#91;u]){\n\n&nbsp; &nbsp; &nbsp; &nbsp; DFS(to,d+1,len+cost);\n\n&nbsp; &nbsp; }\n\n}\n\n  \n  \n\nvoid solve() {\n\n&nbsp; &nbsp; cin&gt;&gt;n&gt;&gt;m&gt;&gt;l&gt;&gt;s&gt;&gt;t;\n\n&nbsp; &nbsp; for(int i=0;i&lt;m;i++){\n\n&nbsp; &nbsp; &nbsp; &nbsp; int u,v,c;\n\n&nbsp; &nbsp; &nbsp; &nbsp; cin&gt;&gt;u&gt;&gt;v&gt;&gt;c;\n\n&nbsp; &nbsp; &nbsp; &nbsp; adj&#91;u].push_back({v,c});\n\n&nbsp; &nbsp; }\n\n&nbsp; &nbsp; DFS(1,0,0);\n\n&nbsp; &nbsp; for(int i=1;i&lt;=n;i++){\n\n&nbsp; &nbsp; &nbsp; &nbsp; if(vis&#91;i])cout&lt;&lt;i&lt;&lt;\" \";\n\n&nbsp; &nbsp; }\n\n&nbsp; &nbsp; cout&lt;&lt;endl;\n\n}\n\n  \n\nsigned main() {\n\n&nbsp; &nbsp; ios_base::sync_with_stdio(false);\n\n&nbsp; &nbsp; cin.tie(nullptr);\n\n&nbsp; &nbsp; \/\/ freopen(\"input.txt\", \"r\", stdin);\n\n&nbsp; &nbsp; \/\/ freopen(\"output.txt\", \"w\", stdout);\n\n&nbsp; &nbsp; \/\/int t; cin &gt;&gt; t; while (t--) solve();\n\n&nbsp; &nbsp; solve();\n\n&nbsp; &nbsp; return 0;\n\n}\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u7ed9\u5b9a\u4e00\u4e2a\u5305\u542b N \u4e2a\u9876\u70b9\u548c M \u6761\u8fb9\u7684\u6709\u5411\u56fe\uff08\u4e0d\u4e00\u5b9a\u662f\u7b80\u5355\u56fe\uff09\uff0c\u9876\u70b9\u7f16\u53f7\u4e3a 1, 2, \\dots, N\u3002 \u7b2c [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":126,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[19,12,10],"tags":[],"class_list":["post-159","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-atc","category-12","category-10"],"_links":{"self":[{"href":"https:\/\/huxiaole.cloud\/index.php\/wp-json\/wp\/v2\/posts\/159","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/huxiaole.cloud\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/huxiaole.cloud\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/huxiaole.cloud\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/huxiaole.cloud\/index.php\/wp-json\/wp\/v2\/comments?post=159"}],"version-history":[{"count":1,"href":"https:\/\/huxiaole.cloud\/index.php\/wp-json\/wp\/v2\/posts\/159\/revisions"}],"predecessor-version":[{"id":160,"href":"https:\/\/huxiaole.cloud\/index.php\/wp-json\/wp\/v2\/posts\/159\/revisions\/160"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/huxiaole.cloud\/index.php\/wp-json\/wp\/v2\/media\/126"}],"wp:attachment":[{"href":"https:\/\/huxiaole.cloud\/index.php\/wp-json\/wp\/v2\/media?parent=159"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/huxiaole.cloud\/index.php\/wp-json\/wp\/v2\/categories?post=159"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/huxiaole.cloud\/index.php\/wp-json\/wp\/v2\/tags?post=159"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}