{"id":251,"date":"2023-07-08T19:01:12","date_gmt":"2023-07-08T11:01:12","guid":{"rendered":"https:\/\/solost.cn\/?p=251"},"modified":"2023-07-08T19:01:12","modified_gmt":"2023-07-08T11:01:12","slug":"379","status":"publish","type":"post","link":"https:\/\/solost.cn\/?p=251","title":{"rendered":"Codeforces Round 882 (Div. 2) &#8211; C. Vampiric Powers, anyone?"},"content":{"rendered":"<h2>\u9898\u76ee\u94fe\u63a5<\/h2>\n<p><a href=\"https:\/\/codeforces.com\/contest\/1847\/problem\/C\">\u94fe\u63a5<\/a><\/p>\n<h2>\u9898\u76ee\u5927\u610f<\/h2>\n<p>\u4e00\u4e2a\u957f\u5ea6\u4e3an\u7684\u6570\u7ec4\uff0c\u4f60\u53ef\u4ee5\u9009\u62e9\u5e8f\u5217\u4e2d\u7684\u4e00\u4e2a\u4f4d\u7f6e\uff0c\u4ecei\u5230m\u5168\u90e8\u5143\u7d20\u5f02\u6216\uff0c\u7136\u540e\u628a\u5f02\u6216\u540e\u7684\u503c\u653e\u5728\u6700\u540e\uff0c\u95ee\u4f60\uff0c\u80fd\u751f\u6210\u6700\u5927\u7684\u7684\u5143\u7d20\u5927\u5c0f\u662f\u591a\u5c11\uff1f<\/p>\n<h2>\u9898\u89e3<\/h2>\n<p>\u6211\u4eec\u53d1\u73b0\uff0cs[i]\u4e3a\u4e00\u4e2a\u5e8f\u5217\u7684\u524d\u7f00\u5f02\u6216\u548c\uff0cs[i, j] = s[i] ^ s[j - 1]\uff0ca ^ b ^ b = a, a ^ b ^ c  ^ b ^ c = a;<\/p>\n<p>\u7528\u8fd9\u4e2a\u6027\u8d28\uff0c\u6211\u4eec\u53ef\u4ee5\u9009\u62e9\u8d77\u70b9\uff0c\u800c\u4e14\u53ef\u4ee5\u901a\u8fc7\u6dfb\u52a0\u672b\u5c3e\u5143\u7d20\uff0c\u53ef\u4ee5\u9009\u62e9\u4e2d\u70b9\uff0c\u90a3\u4e48\u95ee\u9898\u5c31\u8f6c\u6362\u4e3a\u6c42\u4e00\u4e2a\u5e8f\u5217\u7684\u6700\u5927\u8fde\u7eed\u5f02\u6216\u5b50\u5e8f\u5217\uff0c\u7531\u4e8e\u8fd9\u4e2a\u9898\u76ee\u7684a[i]\u6bd4\u8f83\u5c0f\uff0c\u6700\u5927\u4e3a256,\u6240\u4ee5\u53ef\u4ee5\u901a\u8fc7\u6bcf\u6b21\u5b58\u4e0b\u6765\u5f02\u6216\u7684\u7ed3\u679c\uff0c\u7136\u540e\u548c\u5f53\u524d\u7684\u5f02\u6216\u548c\u76f8\u5f02\u6216\uff0c\u8fd9\u6837\u5c31\u76f8\u5f53\u4e8e\u786e\u5b9a\u5f53\u65f6\u7684\u4e2d\u70b9\uff0c\u627e\u8d77\u70b9\uff0c\u6700\u7ec8\u8fbe\u5230\u53ef\u4ee5\u6c42\u51fa\u6700\u5927\u8fde\u7eed\u5f02\u6216\u5b50\u5e8f\u5217\u7684\u6548\u679c\uff0c\u4f46\u662f\u8fd9\u4e2a\u65b9\u6cd5\u4e0d\u662f\u901a\u7528\u7684\uff0c\u5982\u679ca[i]\u7684\u503c\u5927\u4e00\u70b9\u5c31\u7528\u4e0d\u4e86\u4e86\u3002<\/p>\n<h2>\u4ee3\u7801<\/h2>\n<pre><code class=\"lang-cpp\">#include &lt;map&gt;\n#include &lt;set&gt;\n#include &lt;cmath&gt;\n#include &lt;queue&gt;\n#include &lt;stack&gt;\n#include &lt;vector&gt;\n#include &lt;bitset&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;algorithm&gt;\n#include &lt;unordered_map&gt;\n#include &lt;unordered_set&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\nvoid solve()\n{\n    int n;\n    cin &gt;&gt; n;\n    vector&lt;int&gt; a(n);\n    for(int i = 0; i &lt; n; i++){\n        cin &gt;&gt; a[i];\n    }\n    set&lt;int&gt; v;\n    int ans = 0, s = 0;\n    for(int i = 0; i &lt; n; i++){\n        s ^= a[i];\n        ans = max(ans, s);\n        for(auto x : v){\n            ans = max(ans, s ^ x);\n        }\n        v.insert(s);\n    }\n    cout &lt;&lt; ans &lt;&lt; endl;\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 \u4e00\u4e2a\u957f\u5ea6\u4e3an\u7684\u6570\u7ec4\uff0c\u4f60\u53ef\u4ee5\u9009\u62e9\u5e8f\u5217\u4e2d\u7684\u4e00\u4e2a\u4f4d\u7f6e\uff0c\u4ecei\u5230m\u5168\u90e8\u5143\u7d20\u5f02\u6216\uff0c\u7136\u540e\u628a\u5f02\u6216\u540e\u7684\u503c\u653e\u5728\u6700\u540e\uff0c\u95ee\u4f60\uff0c\u80fd\u751f\u6210\u6700\u5927\u7684\u7684\u5143\u7d20\u5927\u5c0f\u662f\u591a\u5c11\uff1f \u9898\u89e3 \u6211\u4eec\u53d1\u73b0\uff0cs[i]\u4e3a\u4e00\u4e2a\u5e8f\u5217\u7684\u524d\u7f00\u5f02\u6216\u548c\uff0cs[i, j] = s[i] ^ s[j - 1]\uff0ca ^ b ^ b = a, a ^ b ^ c ^ b ^ c = a; \u7528\u8fd9\u4e2a\u6027\u8d28\uff0c\u6211\u4eec\u53ef\u4ee5\u9009\u62e9\u8d77\u70b9\uff0c\u800c\u4e14\u53ef\u4ee5\u901a\u8fc7\u6dfb\u52a0\u672b\u5c3e\u5143\u7d20\uff0c\u53ef\u4ee5\u9009\u62e9\u4e2d\u70b9\uff0c\u90a3\u4e48\u95ee\u9898\u5c31\u8f6c\u6362\u4e3a\u6c42\u4e00\u4e2a\u5e8f\u5217\u7684\u6700\u5927\u8fde\u7eed\u5f02\u6216\u5b50\u5e8f\u5217\uff0c\u7531\u4e8e\u8fd9\u4e2a\u9898\u76ee\u7684a[i]\u6bd4\u8f83\u5c0f\uff0c\u6700\u5927\u4e3a256,\u6240\u4ee5\u53ef\u4ee5\u901a\u8fc7\u6bcf\u6b21\u5b58\u4e0b\u6765\u5f02\u6216\u7684\u7ed3\u679c\uff0c\u7136\u540e\u548c\u5f53\u524d\u7684\u5f02\u6216\u548c\u76f8\u5f02\u6216\uff0c\u8fd9\u6837\u5c31\u76f8\u5f53\u4e8e\u786e\u5b9a\u5f53\u65f6\u7684\u4e2d\u70b9\uff0c\u627e\u8d77\u70b9\uff0c\u6700\u7ec8\u8fbe\u5230\u53ef\u4ee5\u6c42\u51fa\u6700\u5927\u8fde\u7eed\u5f02\u6216\u5b50\u5e8f\u5217\u7684\u6548\u679c\uff0c\u4f46\u662f\u8fd9\u4e2a\u65b9\u6cd5\u4e0d\u662f\u901a\u7528\u7684\uff0c\u5982\u679ca[i]\u7684\u503c\u5927\u4e00\u70b9\u5c31\u7528\u4e0d\u4e86\u4e86\u3002 \u4ee3\u7801 #include &lt;map&gt; #include &lt;set&gt; #include &lt;cmath&gt; #include &lt;queue&gt; #include &lt;stack&gt; #include &lt;vector&gt; #include &lt;bitset&gt; #include &lt;cstdio&gt; #include &lt;cstdlib&gt; #include &lt;cstring&gt; #include &lt;fstream&gt; #include [&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":[57,5],"class_list":["post-251","post","type-post","status-publish","format-standard","hentry","category-solution","tag-57","tag-5"],"_links":{"self":[{"href":"https:\/\/solost.cn\/index.php?rest_route=\/wp\/v2\/posts\/251","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=251"}],"version-history":[{"count":0,"href":"https:\/\/solost.cn\/index.php?rest_route=\/wp\/v2\/posts\/251\/revisions"}],"wp:attachment":[{"href":"https:\/\/solost.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=251"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/solost.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=251"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/solost.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=251"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}