{"id":307,"date":"2010-07-17T14:47:00","date_gmt":"2010-07-17T06:47:00","guid":{"rendered":"http:\/\/localhost\/?p=307"},"modified":"2010-07-17T14:47:00","modified_gmt":"2010-07-17T06:47:00","slug":"beijing2010_team_small_tree_spanning_tree","status":"publish","type":"post","link":"https:\/\/www.shuizilong.com\/wjmzbmr\/?p=307","title":{"rendered":"[BeiJing2010\u7ec4\u961f]\u6b21\u5c0f\u751f\u6210\u6811 Tree"},"content":{"rendered":"\n<p>[BeiJing2010\u7ec4\u961f]\u6b21\u5c0f\u751f\u6210\u6811 Tree<\/p>\n<p>Time Limit:10000MS&#160; Memory Limit:65536K<br \/>Total Submit:319 Accepted:40 <br \/>Case Time Limit:1000MS<\/p>\n<p><strong>Description <\/strong><\/p>\n<p>   \u5c0f C \u6700\u8fd1\u5b66\u4e86\u5f88\u591a\u6700\u5c0f\u751f\u6210\u6811\u7684\u7b97\u6cd5\uff0cPrim \u7b97\u6cd5\u3001Kurskal \u7b97\u6cd5\u3001\u6d88\u5708\u7b97\u6cd5 <br \/>\u7b49\u7b49\u3002  <br \/>\u6b63\u5f53\u5c0f C \u6d0b\u6d0b\u5f97\u610f\u4e4b\u65f6\uff0c\u5c0f P \u53c8\u6765\u6cfc\u5c0f C \u51b7\u6c34\u4e86\u3002\u5c0f P \u8bf4\uff0c\u8ba9\u5c0f C \u6c42\u51fa\u4e00 <br \/>\u4e2a\u65e0\u5411\u56fe\u7684\u6b21\u5c0f\u751f\u6210\u6811\uff0c\u800c\u4e14\u8fd9\u4e2a\u6b21\u5c0f\u751f\u6210\u6811\u8fd8\u5f97\u662f\u4e25\u683c\u6b21\u5c0f\u7684\uff0c\u4e5f\u5c31\u662f\u8bf4\uff1a  <br \/>\u5982\u679c\u6700\u5c0f\u751f\u6210\u6811\u9009\u62e9\u7684\u8fb9\u96c6\u662f EM\uff0c\u4e25\u683c\u6b21\u5c0f\u751f\u6210\u6811\u9009\u62e9\u7684\u8fb9\u96c6\u662f ES\uff0c\u90a3\u4e48 <br \/>\u9700\u8981\u6ee1\u8db3\uff1a(value(e)  \u8868\u793a\u8fb9 e\u7684\u6743\u503c)  <\/p>\n<p>\u8fd9\u4e0b\u5c0f C \u8499\u4e86\uff0c\u4ed6\u627e\u5230\u4e86\u4f60\uff0c\u5e0c\u671b\u4f60\u5e2e\u4ed6\u89e3\u51b3\u8fd9\u4e2a\u95ee\u9898\u3002  <\/p>\n<p><strong>Input <\/strong><\/p>\n<p> \u7b2c\u4e00\u884c\u5305\u542b\u4e24\u4e2a\u6574\u6570N \u548cM\uff0c\u8868\u793a\u65e0\u5411\u56fe\u7684\u70b9\u6570\u4e0e\u8fb9\u6570\u3002  <br \/>\u63a5\u4e0b\u6765 M\u884c\uff0c\u6bcf\u884c 3\u4e2a\u6570x y z \u8868\u793a\uff0c\u70b9 x \u548c\u70b9y\u4e4b\u95f4\u6709\u4e00\u6761\u8fb9\uff0c\u8fb9\u7684\u6743\u503c <br \/>\u4e3az\u3002 <\/p>\n<p><strong>Output <\/strong><\/p>\n<p> \u5305\u542b\u4e00\u884c\uff0c\u4ec5\u4e00\u4e2a\u6570\uff0c\u8868\u793a\u4e25\u683c\u6b21\u5c0f\u751f\u6210\u6811\u7684\u8fb9\u6743\u548c\u3002(\u6570 <br \/>\u636e\u4fdd\u8bc1\u5fc5\u5b9a\u5b58\u5728\u4e25\u683c\u6b21\u5c0f\u751f\u6210\u6811)  <\/p>\n<p><strong>Sample Input <\/strong><\/p>\n<p>5 6 <br \/>1 2 1 <br \/>1 3 2 <br \/>2 4 3 <br \/>3 5 4 <br \/>3 4 3 <br \/>4 5 6<\/p>\n<p><strong>Sample Output <\/strong><\/p>\n<p>11<\/p>\n<p><strong>Hint <\/strong><\/p>\n<p> \u6570\u636e\u4e2d\u65e0\u5411\u56fe\u65e0\u81ea\u73af\uff1b  <br \/>50% \u7684\u6570\u636eN\u22642 000 M\u22643 000\uff1b  <br \/>80% \u7684\u6570\u636eN\u226450 000 M\u2264100 000\uff1b  <br \/>100% \u7684\u6570\u636eN\u2264100 000 M\u2264300 000 \uff0c\u8fb9\u6743\u503c\u975e\u8d1f\u4e14\u4e0d\u8d85\u8fc7 10^9 <br \/>\u3002<\/p>\n<p><strong>Source<br \/>\u56e7\u3002\u3002\u6211\u77e5\u9053\u8fd9\u4e2a\u9898\u76ee\u53ef\u4ee5\u7528\u7c7b\u4f3cTarjan\u7684\u7b97\u6cd5\u641e\u51fa\u6765\u3002\u4f46\u6211\u60b2\u5267\u7684\u53d1\u73b0DFS\u5728\u516b\u4e2dOJ\u4e0a\u80af\u5b9a\u7206\u6808\u56e7\u3002\u3002\u53ea\u597d\u7528\u90a3\u79cd\u500d\u589e\u7684\u6765\u505a\u4e86\u3002\u3002\u53cd\u6b63\u590d\u6742\u5ea6\u90fd\u4e00\u6837\u7684\uff08\u56e0\u4e3a\u74f6\u9888\u4e0d\u662f\u8fd9\u4e2a\u800c\u662fMST\uff09\u3002\u3002\u56e0\u4e3a\u8fd9\u6837\u53ef\u4ee5BFS\u3002\u3002<br \/>\u968f\u4fbf\u5199\u4e2aMST\u7b97\u51fa\u6700\u5c0f\u751f\u6210\u6811\uff0c\u7136\u540e\u679a\u4e3e\u6bcf\u4e00\u6761\u975e\u6811\u8fb9\uff0c\u7b97\u51fa\u8fd9\u4e2a\u70b9\u5728\u6811\u4e0a\u5bf9\u5e94\u8def\u5f84\u7684\u6700\u5927\u8fb9\u548c\u6b21\u5927\u8fb9\uff0c\u5982\u679c\u8ddf\u6700\u5927\u8fb9\u4e00\u6837\u5c31\u8ddf\u65b0\u6b21\u5927\u8fb9\uff0c\u5426\u5219\u8ddf\u65b0\u6700\u5927\u8fb9\u5c31OK\u4e86\u3002\u3002<br \/>\u7528\u500d\u589e\u7684\u65b9\u6cd5\u53ef\u4ee5\u5f88\u5bb9\u6613\u7684\u641e\u5b9a\u8fd9\u4e2a\u3002\u3002<br \/>\u5173\u952e\u662fTLE\u56e7\u3002\u3002\u4eceAC\u5927\u795e\u725b\u54ea\u91cc\u6284\u4e86\u4efdSpecil Read\u8fc7\u6765\u3002\u3002\u603b\u7b97\u8fc7\u4e86\u56e7\u3002\u3002<br \/>Code\uff1a<br \/><a href=\"http:\/\/www.ideone.com\/y9EAX\" target=\"_blank\">www.ideone.com\/y9EAX<\/a><br \/> <\/strong><\/p>\n","protected":false},"excerpt":{"rendered":"<p>[BeiJing2010\u7ec4\u961f]\u6b21\u5c0f\u751f\u6210\u6811 Tree Time Limit:10000MS&#160; Memory Limit:65536KTotal Submit:319 Accepted:40 Case Time Limit:1000MS Description \u5c0f C \u6700\u8fd1\u5b66\u4e86\u5f88\u591a\u6700\u5c0f\u751f\u6210\u6811\u7684\u7b97\u6cd5\uff0cPrim \u7b97\u6cd5\u3001Kurskal \u7b97\u6cd5\u3001\u6d88\u5708\u7b97\u6cd5 \u7b49\u7b49\u3002 \u6b63\u5f53\u5c0f C \u6d0b\u6d0b\u5f97\u610f\u4e4b\u65f6\uff0c\u5c0f P \u53c8\u6765\u6cfc\u5c0f C \u51b7\u6c34\u4e86\u3002\u5c0f P \u8bf4\uff0c\u8ba9\u5c0f C \u6c42\u51fa\u4e00 \u4e2a\u65e0\u5411\u56fe\u7684\u6b21\u5c0f\u751f\u6210\u6811\uff0c\u800c\u4e14\u8fd9\u4e2a\u6b21\u5c0f\u751f\u6210\u6811\u8fd8\u5f97\u662f\u4e25\u683c\u6b21\u5c0f\u7684\uff0c\u4e5f\u5c31\u662f\u8bf4\uff1a \u5982\u679c\u6700\u5c0f\u751f\u6210\u6811\u9009\u62e9\u7684\u8fb9\u96c6\u662f EM\uff0c\u4e25\u683c\u6b21\u5c0f\u751f\u6210\u6811\u9009\u62e9\u7684\u8fb9\u96c6\u662f ES\uff0c\u90a3\u4e48 \u9700\u8981\u6ee1\u8db3\uff1a(value(e) \u8868\u793a\u8fb9 e\u7684\u6743\u503c) \u8fd9\u4e0b\u5c0f C \u8499\u4e86\uff0c\u4ed6\u627e\u5230\u4e86\u4f60\uff0c\u5e0c\u671b\u4f60\u5e2e\u4ed6\u89e3\u51b3\u8fd9\u4e2a\u95ee\u9898\u3002 Input \u7b2c\u4e00\u884c\u5305\u542b\u4e24\u4e2a\u6574\u6570N \u548cM\uff0c\u8868\u793a\u65e0\u5411\u56fe\u7684\u70b9\u6570\u4e0e\u8fb9\u6570\u3002 \u63a5\u4e0b\u6765 M\u884c\uff0c\u6bcf\u884c 3\u4e2a\u6570x y z \u8868\u793a\uff0c\u70b9 x \u548c\u70b9y\u4e4b\u95f4\u6709\u4e00\u6761\u8fb9\uff0c\u8fb9\u7684\u6743\u503c \u4e3az\u3002 Output \u5305\u542b\u4e00\u884c\uff0c\u4ec5\u4e00\u4e2a\u6570\uff0c\u8868\u793a\u4e25\u683c\u6b21\u5c0f\u751f\u6210\u6811\u7684\u8fb9\u6743\u548c\u3002(\u6570 \u636e\u4fdd\u8bc1\u5fc5\u5b9a\u5b58\u5728\u4e25\u683c\u6b21\u5c0f\u751f\u6210\u6811) Sample [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[10],"tags":[],"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/www.shuizilong.com\/wjmzbmr\/index.php?rest_route=\/wp\/v2\/posts\/307"}],"collection":[{"href":"https:\/\/www.shuizilong.com\/wjmzbmr\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.shuizilong.com\/wjmzbmr\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.shuizilong.com\/wjmzbmr\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.shuizilong.com\/wjmzbmr\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=307"}],"version-history":[{"count":0,"href":"https:\/\/www.shuizilong.com\/wjmzbmr\/index.php?rest_route=\/wp\/v2\/posts\/307\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.shuizilong.com\/wjmzbmr\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=307"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.shuizilong.com\/wjmzbmr\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=307"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.shuizilong.com\/wjmzbmr\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=307"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}