{"id":1993,"date":"2022-07-15T17:44:11","date_gmt":"2022-07-15T09:44:11","guid":{"rendered":"https:\/\/www.shuizilong.com\/house\/?p=1993"},"modified":"2022-07-15T20:33:21","modified_gmt":"2022-07-15T12:33:21","slug":"codeforces-tinkoff-challenge-elimination-round","status":"publish","type":"post","link":"https:\/\/www.shuizilong.com\/house\/archives\/codeforces-tinkoff-challenge-elimination-round\/","title":{"rendered":"Codeforces Tinkoff Challenge &#8211; Elimination Round"},"content":{"rendered":"<h2>G. Oleg and chess<\/h2>\n<p>\u5148\u8003\u8651\u7f51\u7edc\u6d41\u3002\u3002\u3002\u662f\u6700\u6734\u7d20\u7684\u4e8c\u5206\u56fe\u5339\u914d\u3002\u3002\u3002<br \/>\n\u8fd8\u662f\u8bbe\u6cd5\u8981\u51cf\u5c11\u8fb9\u7684\u89c4\u6a21\u3002\u3002\u3002\u6211\u4eec\u7c7b\u6bd4\u626b\u63cf\u7ebf\u6765\u505a\u77e9\u5f62\u5408\u5e76\u3002\u3002<br \/>\n\u4ece\u5de6\u5230\u53f3\u626b\u63cf\u6bcf\u4e00\u5217\uff0c\u6211\u4eec\u7528\u51fd\u6570\u5f0f\u7ebf\u6bb5\u6811\uff0c\u5c31\u80fd\u7ef4\u62a4\u51fa\u4ee3\u8868\u8fd9\u4e00\u5217\u7684\u7ebf\u6bb5\u6811\u7684\u6839\u8282\u70b9\u72b6\u6001\u3002\u3002<br \/>\n\u90a3\u4e48\u53ea\u8981\u4ece\u6e90\u70b9\u5411\u6839\u8282\u70b9\u8fde\u8fc7\u53bb\u4e00\u6761\u5bb9\u91cf\u4e3a 1 \u7684\u8fb9\u5373\u53ef\u3002\u3002\u6ce8\u610f\u9700\u8981\u4fdd\u8bc1\u8fd9\u4e9b\u7ebf\u6bb5\u6811\u5171\u4eab\u540c\u4e00\u7ec4\u95ed\u5408\u72b6\u6001\u3002\u3002\u3002<\/p>\n<p>\u603b\u611f\u89c9\u6709\u66f4\u597d\u7684\u505a\u6cd5\u3002\u3002\u3002<\/p>\n<pre class=\"brush: cpp; light: false; title: ; toolbar: true; notranslate\" title=\"\">\r\nconst int N = int(1e4) + 9;\r\n\r\nint T&#x5B;N], H&#x5B;N]; VI adj&#x5B;N];\r\nint n, m;\r\n\r\nnamespace Chairman_Tree {\r\n#define lx c&#x5B;0]&#x5B;x]\r\n#define rx c&#x5B;1]&#x5B;x]\r\n#define ly c&#x5B;0]&#x5B;y]\r\n#define ry c&#x5B;1]&#x5B;y]\r\n#define lz c&#x5B;0]&#x5B;z]\r\n#define rz c&#x5B;1]&#x5B;z]\r\n#define ml ((l+r)&gt;&gt;1)\r\n#define mr (ml+1)\r\n#define lc lx, l, ml\r\n#define rc rx, mr, r\r\n    const int NN = 100*N;\r\n    int c&#x5B;2]&#x5B;NN]; int tot;\r\n    int pp; int dd;\r\n    int new_node() {\r\n        return ++tot;\r\n    }\r\n    int new_node(int y) {\r\n        int x = ++tot; lx = ly; rx = ry;\r\n        return x;\r\n    }\r\n\r\n    void Build(int&amp; x, int l, int r) {\r\n        if (l == r) {\r\n            x = l;\r\n        } else {\r\n            x = new_node();\r\n            Build(lc);\r\n            Build(rc);\r\n        }\r\n    }\r\n\r\n    int Insert(int x, int l, int r, int y, int a, int b) {\r\n        if (b &lt; l || r &lt; a) return x;\r\n        if (a &lt;= l &amp;&amp; r &lt;= b) {\r\n            return y;\r\n        } else {\r\n            x = new_node(x);\r\n            lx = Insert(lc, ly, a, b);\r\n            rx = Insert(rc, ry, a, b);\r\n            return x;\r\n        }\r\n    }\r\n\r\n} using namespace Chairman_Tree;\r\n\r\nVII del&#x5B;N], add&#x5B;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;\/Users\/minakokojima\/Documents\/GitHub\/ACM-Training\/Workspace\/out.txt&quot;, &quot;w&quot;, stdout);\r\n#endif\r\n\r\n    RD(n); Rush {\r\n        int x1, y1, x2, y2; RD(x1, y1, x2, y2); ++x2;\r\n        add&#x5B;x1].PB({y1, y2});\r\n        del&#x5B;x2].PB({y1, y2});\r\n    }\r\n\r\n    atcoder::mf_graph&lt;int&gt; G(NN);\r\n    int s = 0, t = n+1; REP_1(i, n) G.add_edge(i, t, 1);\r\n    tot = t;\r\n\r\n    int x; Build(x, 1, n); int o = x, a = 0; REP_1(i, n) {\r\n        int y = x;\r\n        for (auto e: del&#x5B;i]) x = Insert(x, 1, n, o, e.fi, e.se);\r\n        for (auto e: add&#x5B;i]) x = Insert(x, 1, n, 0, e.fi, e.se);\r\n        if (x != y) {\r\n            if (y &amp;&amp; a) G.add_edge(s, y, a);\r\n            a = 0;\r\n        }\r\n        ++a;\r\n    }\r\n    if (x) G.add_edge(s, x, a);\r\n\r\n    FOR_1(x, t+1, tot) {\r\n        if (lx) G.add_edge(x, lx, INF);\r\n        if (rx) G.add_edge(x, rx, INF);\r\n    }\r\n\r\n    cout &lt;&lt; G.flow(s, t) &lt;&lt; endl;\r\n}\r\n\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>G. Oleg and chess \u5148\u8003\u8651\u7f51\u7edc\u6d41\u3002\u3002\u3002\u662f\u6700\u6734\u7d20\u7684\u4e8c\u5206\u56fe\u5339\u914d\u3002\u3002\u3002 \u8fd8\u662f\u8bbe\u6cd5\u8981\u51cf\u5c11\u8fb9\u7684\u89c4\u6a21\u3002\u3002\u3002\u6211\u4eec\u7c7b\u6bd4\u626b\u63cf\u7ebf\u6765\u505a\u77e9\u5f62\u5408\u5e76\u3002\u3002 \u4ece\u5de6\u5230\u53f3\u626b\u63cf\u6bcf\u4e00\u5217\uff0c\u6211\u4eec\u7528\u51fd\u6570\u5f0f\u7ebf\u6bb5\u6811\uff0c\u5c31\u80fd\u7ef4\u62a4\u51fa\u4ee3\u8868\u8fd9\u4e00\u5217\u7684\u7ebf\u6bb5\u6811\u7684\u6839\u8282\u70b9\u72b6\u6001\u3002\u3002 \u90a3\u4e48\u53ea\u8981\u4ece\u6e90\u70b9\u5411\u6839\u8282\u70b9\u8fde\u8fc7\u53bb\u4e00\u6761\u5bb9\u91cf\u4e3a 1 \u7684\u8fb9\u5373\u53ef\u3002\u3002\u6ce8\u610f\u9700\u8981\u4fdd\u8bc1\u8fd9\u4e9b\u7ebf\u6bb5\u6811\u5171\u4eab\u540c\u4e00\u7ec4\u95ed\u5408\u72b6\u6001\u3002\u3002\u3002 \u603b\u611f\u89c9\u6709\u66f4\u597d\u7684\u505a\u6cd5\u3002\u3002\u3002 const int N = int(1e4) + 9; int T&#x5B;N], H&#x5B;N]; VI adj&#x5B;N]; int n, m; namespace Chairman_Tree { #define lx c&#x5B;0]&#x5B;x] #define rx c&#x5B;1]&#x5B;x] #define ly c&#x5B;0]&#x5B;y] #define ry c&#x5B;1]&#x5B;y] #define lz c&#x5B;0]&#x5B;z] #define rz c&#x5B;1]&#x5B;z] #define ml ((l+r)&gt;&gt;1) #define mr (ml+1) #define lc [&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-1993","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p2tdP7-w9","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.shuizilong.com\/house\/wp-json\/wp\/v2\/posts\/1993","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=1993"}],"version-history":[{"count":1,"href":"https:\/\/www.shuizilong.com\/house\/wp-json\/wp\/v2\/posts\/1993\/revisions"}],"predecessor-version":[{"id":1994,"href":"https:\/\/www.shuizilong.com\/house\/wp-json\/wp\/v2\/posts\/1993\/revisions\/1994"}],"wp:attachment":[{"href":"https:\/\/www.shuizilong.com\/house\/wp-json\/wp\/v2\/media?parent=1993"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.shuizilong.com\/house\/wp-json\/wp\/v2\/categories?post=1993"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.shuizilong.com\/house\/wp-json\/wp\/v2\/tags?post=1993"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}