{"id":252,"date":"2023-07-12T14:51:47","date_gmt":"2023-07-12T06:51:47","guid":{"rendered":"https:\/\/solost.cn\/?p=252"},"modified":"2023-07-12T14:51:47","modified_gmt":"2023-07-12T06:51:47","slug":"380","status":"publish","type":"post","link":"https:\/\/solost.cn\/?p=252","title":{"rendered":"2021 RoboCom \u4e16\u754c\u673a\u5668\u4eba\u5f00\u53d1\u8005\u5927\u8d5b-\u672c\u79d1\u7ec4\uff08\u521d\u8d5b\uff09- 7-4 \u75ab\u60c5\u9632\u63a7"},"content":{"rendered":"<h2>\u9898\u76ee\u94fe\u63a5<\/h2>\n<p><a href=\"https:\/\/pintia.cn\/problem-sets\/1446838676759703552\/exam\/problems\/1446838732288094211\">\u94fe\u63a5<\/a><\/p>\n<h2>\u9898\u76ee\u5927\u610f<\/h2>\n<p>n\u4e2a\u70b9\uff0cm\u6761\u8def\u5f84\uff0cd\u6b21\u8be2\u95ee\uff0c\u6bcf\u6b21\u9501\u5b9a\u4e00\u4e2a\u70b9c,\u7ed9\u51faq\u6761\u8fb9\uff0c\u95ee\uff0cq\u6761\u8fb9\u5728\u9501\u5b9ac\u70b9\u540e\u591a\u5c11\u6761\u8fb9\u65e0\u6cd5\u8fde\u901a<\/p>\n<h2>\u9898\u89e3<\/h2>\n<p>\u5e76\u67e5\u96c6\u652f\u6301\u52a0\u4e00\u4e9b\u70b9\u8fdb\u53bb\u6765\u5224\u65ad\u662f\u4e0d\u662f\u5728\u4e00\u4e2a\u96c6\u5408\uff0c\u4f46\u662f\u5982\u679c\u5220\u53bb\u4e00\u4e2a\u70b9\u5c31\u4e0d\u77e5\u9053\u591a\u5c11\u4e2a\u70b9\u4f1a\u53d7\u5f71\u54cd\uff0c\u6240\u4ee5\uff0c\u8fd9\u9053\u9898\u7684\u7cbe\u534e\u5c31\u662f\u5012\u8fc7\u6765\uff0c\u5148\u5c06\u90a3\u4e9b\u4ece\u6765\u6ca1\u6709\u9501\u5b9a\u7684\u70b9\u6784\u5efa\u5e76\u67e5\u96c6\uff0c\u7136\u540e\u5012\u8fc7\u6765\u5904\u7406\uff0c\u6bcf\u6b21\u91ca\u653e\u4e00\u4e2a\u70b9\uff0c\u5e76\u67e5\u96c6\u7ef4\u62a4\u6ca1\u6709\u9501\u5b9a\u70b9\u7684\u96c6\u5408\u3002<\/p>\n<h2>\u4ee3\u7801<\/h2>\n<pre><code class=\"lang-cpp\">#include &lt;algorithm&gt;\n#include &lt;bitset&gt;\n#include &lt;cmath&gt;\n#include &lt;cstdio&gt;\n#include &lt;cstdlib&gt;\n#include &lt;cstring&gt;\n#include &lt;fstream&gt;\n#include &lt;iostream&gt;\n#include &lt;map&gt;\n#include &lt;queue&gt;\n#include &lt;set&gt;\n#include &lt;stack&gt;\n#include &lt;unordered_map&gt;\n#include &lt;unordered_set&gt;\n#include &lt;vector&gt;\n\n#define x first\n#define y second\n#define endl &#039;\\n&#039;\n#define IOS                       \\\n    ios_base::sync_with_stdio(0); \\\n    cin.tie(0);                   \\\n    cout.tie(0);\n\nusing namespace std;\n\ntypedef long long ll;\ntypedef pair&lt;ll, ll&gt; pll;\ntypedef pair&lt;int, int&gt; pii;\ntypedef unsigned long long ull;\n\nconst int INF = 0x3f3f3f3f, mod = 1000000007;\nconst int N = 2e5 + 10;\n\nint n, m, d;\nint day[N], p[N];\nvector&lt;int&gt; a[N];\nvector&lt;pii&gt; v[N];\nmap&lt;int, int&gt; vis;\n\nint find(int x)\n{\n    if (x != p[x])\n        p[x] = find(p[x]);\n    return p[x];\n}\n\nvoid solve()\n{\n    cin &gt;&gt; n &gt;&gt; m &gt;&gt; d;\n    for (int i = 1; i &lt;= n; i++) {\n        p[i] = i;\n    }\n    for (int i = 1; i &lt;= m; i++) {\n        int x, y;\n        cin &gt;&gt; x &gt;&gt; y;\n        a[x].push_back(y);\n        a[y].push_back(x);\n    }\n    for (int i = 1; i &lt;= d; i++) {\n        int c, q;\n        cin &gt;&gt; c &gt;&gt; q;\n        day[i] = c;\n        vis[c] = 1;\n        while (q--) {\n            int x, y;\n            cin &gt;&gt; x &gt;&gt; y;\n            v[i].push_back({x, y});\n        }\n    }\n\n    for(int i = 1; i &lt;= n; i++){\n        if(vis[i]) continue;\n        for(auto x : a[i]){\n            if(vis[x]) continue;\n            int fx = find(x), fy = find(i);\n            if(fx != fy) p[fx] = fy;\n        }\n    }\n\n    stack&lt;int&gt; q;\n    for (int i = d; i; i--) {\n        int cnt = 0, c = day[i];\n        for(auto x : v[i]){\n            int fx = find(x.x), fy = find(x.y);\n            if(fx != fy) cnt++;\n        }\n        q.push(cnt);\n\n        for(auto x : a[c]){\n            if(vis[x]) continue;\n            int fx = find(x), fy = find(c);\n            if(fx != fy) p[fx] = fy;\n        }\n        vis[c] = 0;\n\n    }\n    while (q.size()) {\n        cout &lt;&lt; q.top() &lt;&lt; endl;\n        q.pop();\n    }\n}\nint main()\n{\n    \/\/ IOS;\n    int _ = 1;\n    \/\/ cin &gt;&gt; _;\n    while (_--) {\n        solve();\n    }\n    return 0;\n}<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u9898\u76ee\u94fe\u63a5 \u94fe\u63a5 \u9898\u76ee\u5927\u610f n\u4e2a\u70b9\uff0cm\u6761\u8def\u5f84\uff0cd\u6b21\u8be2\u95ee\uff0c\u6bcf\u6b21\u9501\u5b9a\u4e00\u4e2a\u70b9c,\u7ed9\u51faq\u6761\u8fb9\uff0c\u95ee\uff0cq\u6761\u8fb9\u5728\u9501\u5b9ac\u70b9\u540e\u591a\u5c11\u6761\u8fb9\u65e0\u6cd5\u8fde\u901a \u9898\u89e3 \u5e76\u67e5\u96c6\u652f\u6301\u52a0\u4e00\u4e9b\u70b9\u8fdb\u53bb\u6765\u5224\u65ad\u662f\u4e0d\u662f\u5728\u4e00\u4e2a\u96c6\u5408\uff0c\u4f46\u662f\u5982\u679c\u5220\u53bb\u4e00\u4e2a\u70b9\u5c31\u4e0d\u77e5\u9053\u591a\u5c11\u4e2a\u70b9\u4f1a\u53d7\u5f71\u54cd\uff0c\u6240\u4ee5\uff0c\u8fd9\u9053\u9898\u7684\u7cbe\u534e\u5c31\u662f\u5012\u8fc7\u6765\uff0c\u5148\u5c06\u90a3\u4e9b\u4ece\u6765\u6ca1\u6709\u9501\u5b9a\u7684\u70b9\u6784\u5efa\u5e76\u67e5\u96c6\uff0c\u7136\u540e\u5012\u8fc7\u6765\u5904\u7406\uff0c\u6bcf\u6b21\u91ca\u653e\u4e00\u4e2a\u70b9\uff0c\u5e76\u67e5\u96c6\u7ef4\u62a4\u6ca1\u6709\u9501\u5b9a\u70b9\u7684\u96c6\u5408\u3002 \u4ee3\u7801 #include &lt;algorithm&gt; #include &lt;bitset&gt; #include &lt;cmath&gt; #include &lt;cstdio&gt; #include &lt;cstdlib&gt; #include &lt;cstring&gt; #include &lt;fstream&gt; #include &lt;iostream&gt; #include &lt;map&gt; #include &lt;queue&gt; #include &lt;set&gt; #include &lt;stack&gt; #include &lt;unordered_map&gt; #include &lt;unordered_set&gt; #include &lt;vector&gt; #define x first #define y second #define endl &#039;\\n&#039; #define IOS \\ ios_base::sync_with_stdio(0); \\ cin.tie(0); \\ cout.tie(0); using [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[12,5],"class_list":["post-252","post","type-post","status-publish","format-standard","hentry","category-solution","tag-12","tag-5"],"_links":{"self":[{"href":"https:\/\/solost.cn\/index.php?rest_route=\/wp\/v2\/posts\/252","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/solost.cn\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/solost.cn\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/solost.cn\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/solost.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=252"}],"version-history":[{"count":0,"href":"https:\/\/solost.cn\/index.php?rest_route=\/wp\/v2\/posts\/252\/revisions"}],"wp:attachment":[{"href":"https:\/\/solost.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=252"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/solost.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=252"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/solost.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=252"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}