{"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":"HTML","content":"\u003cp\u003e给你一个数组 $$$a$$$,由 $$$n$$$ 个整数 $$$a_1,a_2,\\dots,a_n$$$ 组成。你可以对这个数组执行两种操作:\u003c/p\u003e\n\n\u003col\u003e \n\u003cli\u003e求和:计算区间 $$$[l,r]$$$ 上的当前数组元素的和,即计算 $$$a_l + a_{l+1} + \\dots + a_r$$$ 的值。\u003c/li\u003e\n\u003cli\u003e异或:对区间 $$$[l,r]$$$ 上的每个数组元素,用给定的整数 $$$x$$$ 施加 xor 操作,即执行 $$$a_l\u003da_l \\oplus x,~$$$ $$$a_{l+1} \u003d a_{l+1} \\oplus x,~$$$ $$$\\dots,~$$$ $$$a_r \u003d a_r \\oplus x$$$ 。该操作恰好改变了 $$$r-l+1$$$ 个数组元素。 \u003c/li\u003e\n\u003c/ol\u003e\n\n\u003cp\u003e表达式 $$$x \\oplus y$$$ 表示对整数 $$$x$$$ 和 $$$y$$$ 执行按位异或的操作。此操作在所有现代编程语言中都存在,例如在 C++ 中,它被标记为 \"\u003cspan class\u003d\"tex-font-style-tt\"\u003e^\u003c/span\u003e\"。\u003c/p\u003e\n\n\u003cp\u003e给你一个包含 \u003cspan class\u003d\"tex-span\"\u003e\u003ci\u003em\u003c/i\u003e\u003c/span\u003e 个指定类型操作的列表。你的任务是执行给定的所有操作,并为每个求和查询打印结果。\u003c/p\u003e"}},{"title":"输入","value":{"format":"HTML","content":"\u003cp\u003e第一行包含整数 $$$n$$$ $$$(1 \\leq n \\leq 10^5)$$$,表示数组的大小。\u003c/p\u003e\n\n\u003cp\u003e第二行包含整数 $$$a_1,a_2,\\dots,a_n$$$ $$$(0 \\leq a_i \\leq 10^6)$$$,表示原始数组。 \u003c/p\u003e\n\n\u003cp\u003e第三行包含整数 $$$m$$$ $$$(1 \\leq m \\leq 5 \\cdot 10^4)$$$,表示数组的操作次数。\u003c/p\u003e\n\n\u003cp\u003e接下来的 $$$m$$$ 行中,第 $$$i$$$ 行首先包含一个整数 $$$t_i$$$ $$$(1 \\leq t_i \\leq 2)$$$,表示第 $$$i$$$ 个查询的类型。如果 $$$t_i\u003d1$$$,那么这是一个求和查询;如果 $$$t_i\u003d2$$$,那么这是一个异或查询。如果是求和查询,则跟随两个整数 $$$l_i,r_i$$$ $$$(1 \\leq l_i \\leq r_i \\leq n)$$$;如果是异或查询,则跟随三个整数 $$$l_i,r_i,x_i$$$ $$$(1 \\leq l_i \\leq r_i \\leq n,~1 \\leq x_i \\leq 10^6)$$$。每行中的各整数以单个空格分隔。\u003c/p\u003e"}},{"title":"输出","value":{"format":"HTML","content":"\u003cp\u003e对于每个类型为 $$$1$$$ 的查询,在一行中打印给定区间上各整数之和。按照输入中查询的顺序打印查询的答案。\u003c/p\u003e\n\n\u003cp\u003e请不要在 C++ 中使用 \u003cspan class\u003d\"tex-font-style-tt\"\u003e%lld\u003c/span\u003e 格式符来读取或写入 64 位整数。最好使用 \u003cspan class\u003d\"tex-font-style-tt\"\u003ecin\u003c/span\u003e、\u003cspan class\u003d\"tex-font-style-tt\"\u003ecout\u003c/span\u003e 流,或 \u003cspan class\u003d\"tex-font-style-tt\"\u003e%I64d\u003c/span\u003e 格式符。\u003c/p\u003e"}},{"title":"示例 1","value":{"format":"HTML","content":"\u003ctable class\u003d\u0027vjudge_sample\u0027\u003e\n\u003cthead\u003e\n \u003ctr\u003e\n \u003cth\u003eInput\u003c/th\u003e\n \u003cth\u003eOutput\u003c/th\u003e\n \u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n \u003ctr\u003e\n \u003ctd\u003e\u003cpre\u003e5\n4 10 3 13 7\n8\n1 2 4\n2 1 3 3\n1 2 4\n1 3 3\n2 2 5 5\n1 1 5\n2 1 2 10\n1 2 3\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e26\n22\n0\n34\n11\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e"}},{"title":"示例 2","value":{"format":"HTML","content":"\u003ctable class\u003d\u0027vjudge_sample\u0027\u003e\n\u003cthead\u003e\n \u003ctr\u003e\n \u003cth\u003eInput\u003c/th\u003e\n \u003cth\u003eOutput\u003c/th\u003e\n \u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n \u003ctr\u003e\n \u003ctd\u003e\u003cpre\u003e6\n4 7 4 0 7 3\n5\n2 2 3 8\n1 1 5\n2 3 5 1\n2 4 5 6\n1 2 3\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e38\n28\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e"}}]}