An atcoder — progvar bitwise problem

Правка en1, от Mexicano, 2024-02-07 22:56:13

I found this problem here. basics — bitwise operations, and this is the link of it.

Any accepted solution depends on a greedy approach that walking from the MSB, but it's clear that it doesn't work on very simple tests like that

3 4

1 1 4

The greedy approach makes X = 4 which give a result = 10, the real solution must make X = 2, so the result = 12.

That means there's a bug in this problem, so any suggestions to solve it with a trusted approach?

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en1 Английский Mexicano 2024-02-07 22:56:13 593 Initial revision (published)