给一个数组,里面n个数 a i a_i ai。You are allowed to perform the following operation: choose two distinct indices 1≤i,j≤n. If before the operation ai=x, aj=y, then after the operation ai=x AND y, aj=x OR y,
然后求 ∑ a i \sum a_i ∑ai最大值
设 x 1 < x 2 x_1<x_2 x1<x2根据AND 和 OR 操作的特点,有
y 1 = x 1 ∣ x 2 = x 2 + α y 2 = x 2 & x 2 = x 1 − α α = ( x 2 ) & x 1 y_1 = x_1 | x_2 = x_2+\alpha \\ y_2 = x_2 \& x_2 =x_1-\alpha \\ \alpha = (~x_2) \& x_1 \\ y1=x1