{"trustable":false,"prependHtml":"\u003cstyle type\u003d\u0027text/css\u0027\u003e\n .input, .output {\n border: 1px solid #888888;\n }\n .output {\n margin-bottom: 1em;\n position: relative;\n top: -1px;\n }\n .output pre, .input pre {\n background-color: #EFEFEF;\n line-height: 1.25em;\n margin: 0;\n padding: 0.25em;\n }\n \u003c/style\u003e\n \u003clink rel\u003d\"stylesheet\" href\u003d\"//codeforces.org/s/96598/css/problem-statement.css\" type\u003d\"text/css\" /\u003e\u003cscript\u003e window.katexOptions \u003d { disable: true }; \u003c/script\u003e\n\u003cscript type\u003d\"text/x-mathjax-config\"\u003e\n MathJax.Hub.Config({\n tex2jax: {\n inlineMath: [[\u0027$$$\u0027,\u0027$$$\u0027], [\u0027$\u0027,\u0027$\u0027]],\n displayMath: [[\u0027$$$$$$\u0027,\u0027$$$$$$\u0027], [\u0027$$\u0027,\u0027$$\u0027]]\n }\n });\n\u003c/script\u003e\n\u003cscript type\u003d\"text/javascript\" async src\u003d\"https://mathjax.codeforces.org/MathJax.js?config\u003dTeX-AMS_HTML-full\"\u003e\u003c/script\u003e","sections":[{"title":"","value":{"format":"MD","content":"# Vladik and Memorable Trip\n\n## 题面翻译\n\n一个区间 $\\left[l,r\\right]$ 合法当且仅当这个区间里的任何数不在区间外出现。一个区间的价值是其中所有出现的数的异或和,即重复的数只计算一次。将 $[1,n]$ 分成若干段合法区间,问它们的价值和最大是多少。\n\n## 输入格式\n\n第一行给出一个整数 $ n $ ( $ 1\u003c\u003dn\u003c\u003d5000 $ ) — 总数量.\n\n第二行包含 $ n $个整数 $ a_{1},a_{2},...,a_{n} $ ( $ 0\u003c\u003da_{i}\u003c\u003d5000 $ )\n\n## 输出格式\n\n输出最大价值和\n\n## 样例 #1\n\n### 样例输入 #1\n\n```\n6\n4 4 2 5 2 3\n```\n\n### 样例输出 #1\n\n```\n14\n```\n\n## 样例 #2\n\n### 样例输入 #2\n\n```\n9\n5 1 3 1 5 2 4 2 5\n```\n\n### 样例输出 #2\n\n```\n9\n```\n\n## 提示\n\n第一个样例: $ [4,4] $ $ [2,5,2] $ $ [3] $ , 答案: $ 4+(2 $ $ xor $ $ 5)+3\u003d4+7+3\u003d14 $\n\n第二个样例: $ 5 $ $ 1 $ $ [3] $ $ 1 $ $ 5 $ $ [2,4,2] $ $ 5 $ , 答案: $ 3+(2 $ $ xor $ $ 4)\u003d3+6\u003d9 $ ."}}]}