cunzai_zsy0531

关注我

CF1665E MinimizOR

Post time: 2022-04-09 13:48:24

官方题解对 \(\log+1\) 结论的归纳证明:

Now let's prove the key idea: let's prove by induction that if all numbers are less than \(2k\) then it's enough to consider \(k+1\) minimal numbers.

Base case:

\(k=1\), all numbers are from \(0\) to \(1\) and the proof is obvious.

Inductive step:

Let's show that for any \(k\geq 1\) if for \(k\) the statement is true then it's true for \(k+1\).

If all numbers have \(1\) in k-th bit then the k-th bit of the answer is also \(1\), that's why we only have to minimize the remaining bits. For these bits we can apply the induction hypothesis that \(k+1\) minimal numbers are enough. If at least two numbers have \(0\) in their k-th bit then the k-th bit in the answer is also \(0\). That's why we only consider only numbers with \(0\) in k-th bit and we have to minimize the remaining bits. Again applying the induction hypothesis, \(k+1\) minimal numbers are enough. If there is exactly one number with \(0\) in k-th bit then the k-th bit in the answer is \(1\) and we have to find \(k+1\) minimal numbers over \(k\) bits. They are among \(k+2\) minimal numbers over \(k+1\) bits, so \(k+2\) minimal numbers are enough.

posted @ 2022-04-22 16:06  cunzai_zsy0531  阅读(26)  评论(0编辑  收藏  举报