E. AT_abc117_d [ABC117D] XXOR

    Type: Default 1000ms 256MiB

AT_abc117_d [ABC117D] XXOR

You cannot submit for this problem because the contest is ended. You can click "Open in Problem Set" to view this problem in normal mode.

AT_abc117_d [ABC117D] XXOR

题目描述

有n个数 a1,a2,,ana_1,a_2,\dots,a_n 和一个数 kk\oplus 表示按位异或。对于 $0\leq x\leq k,f(x)=(x \oplus a_1)+(x \oplus a_2)……(x \oplus a_n)$。求 fmaxf_{\max} 为多少。

输入格式

一行两个数 n,mn,m,接下来一行 mm 个用空格隔开的整数 x1,x2,,xnx_1,x_2,\dots,x_n

输出格式

一行一个数表示答案。

输入输出样例 #1

输入 #1

3 7
1 6 3

输出 #1

14

输入输出样例 #2

输入 #2

4 9
7 4 0 3

输出 #2

46

输入输出样例 #3

输入 #3

1 0
1000000000000

输出 #3

1000000000000

说明/提示

1n105,0k,ai10121\leq n\leq 10^5,0\leq k,a_i\leq 10^{12}

0110B

Not Attended
Status
Done
Rule
IOI
Problem
5
Start at
2026-1-10 14:00
End at
2026-1-10 17:00
Duration
3 hour(s)
Host
Partic.
57