Codeforces Round #379 (div 2) contest problem F

Here my solution:

As we can see: b[i] = Σ(a[i]&a[k]) and c[i] = Σ(a[i]|a[k]) (1<=k<=n). But (a[i]&a[k]) + (a[i]|a[k]) == a[i] + a[k]. So we have b[i] + c[i] = na[i] + Σ(a[k]) (1<=k<=n). From above we can easily calculate Σ(a[k])(1<=k<=n) because Σ(b[i]+c[i]) (1<=i<=n) = 2n*Σ(a[i]) (1<=i<=n) => a[i] = ((b[i] + c[i])-(Σ(a[k]))/2.
We do the same thing with every element in a[]. (See the problem here)
But why it’s a still Wrong Answer solution?

1 Like
//