{"problem":{"name":"[XJTUPC 2024] 循环移位","description":{"content":"给定长度为 $2^n$ 的数组 $a_i$ ($0 \\leq i < 2^n$)，你可以进行任意次循环移位。 求 $\\sum_{i=0}^{2^n-1} a_i \\oplus i$， $\\sum_{i=0}^{2^n-1} a_i \\& i$，$\\sum_{i=0}^{2^n-1} a_i | i$ 的最大值。其中 $\\oplus, \\&, |$ 分别代表按位异或，按位与，按位或。 对于一个长","description_type":"Markdown"},"platform":"Luogu","limit":{"time_limit":2000,"memory_limit":262144},"difficulty":{"LuoguStyle":"P6"},"is_remote":true,"is_sync":true,"sync_url":null,"sign":"LGP10524"},"statements":[{"statement_type":"Markdown","content":"给定长度为 $2^n$ 的数组 $a_i$ ($0 \\leq i < 2^n$)，你可以进行任意次循环移位。\n\n求 $\\sum_{i=0}^{2^n-1} a_i \\oplus i$， $\\sum_{i=0}^{2^n-1} a_i \\& i$，$\\sum_{i=0}^{2^n-1} a_i | i$ 的最大值。其中 $\\oplus, \\&, |$ 分别代表按位异或，按位与，按位或。\n\n对于一个长度为 $m$ 的数组 $x_i$ ($0 \\leq i < m$)，其进行循环移位的结果 $x'_i$ 为:\n\n$$x'_i = \\left\\{\n\t\\begin{array}{ll}\n\t\tx_{i - 1} & i \\neq 0 \\\\\n\t\tx_{m - 1} & i = 0\n\t\\end{array}\\right.$$\n\n## Input\n\n输入第一行包含一个整数 $n$ ($1 \\leq n \\leq 20$)，含义如题意所述。\n\n接下来一行包含 $2^n$ 个整数 $a_i$ ($0 \\leq a_i < 2^n$)，为给定的数组。\n\n## Output\n\n输出一行三个整数，由空格隔开，为 $\\sum_{i=0}^{2^n-1} a_i \\oplus i$，$\\sum_{i=0}^{2^n-1} a_i \\& i$，$\\sum_{i=0}^{2^n-1} a_i | i$ 的最大值。\n\n[samples]","is_translate":false,"language":"English"}],"meta":{"iden":"LGP10524","tags":["2024","O2优化","高校校赛"],"sample_group":[["2\n1 3 2 2\n","8 5 11\n"],["4\n1 1 4 5 1 4 1 9 1 9 8 1 0 0 0 0\n","149 41 157\n"]],"created_at":"2026-03-03 11:09:25"}}