633 div2 C — My logic is different(may be incorrect) but still got AC

Revision en2, by forget_it, 2020-04-13 13:24:16

Round #633 div2 C (yesterday round):

While Practicing ,I got AC in it ,but i am still not convinced that my solution is correct.

I looked for editorial they said to approach d/f approach as 1 +2 +4 +.... to reach a number . But ,i just simply found the minimum power of 2 which is greater than or equal to our maximum difference. And output that power.

Also to note that in question it was said 2^(x-1) is added to x cost only , but i didn't consider that , i added x for 2^x but still passed TC.

Please Someone tell me ,why i am correct Or give some test case where my solution fails.

76475571

Tags #633, #array, #implementaion, #maths, #c++

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en2 English forget_it 2020-04-13 13:24:16 28 Tiny change: 'der that ,still pass' -> 'der that , i added x for 2^x but still pass'
en1 English forget_it 2020-04-13 13:22:57 672 Initial revision (published)