Блог пользователя ishan_luhani

Автор ishan_luhani, история, 2 месяца назад, По-английски

Problem: Problem 1632B

I can't understand this problem's editorial, from where to derive this 2k−1 , 2k−2 , … , 0 , 2k , 2k+1 , … , n−1

How can I approach other bitmasks problems?

  • Проголосовать: нравится
  • +1
  • Проголосовать: не нравится

»
2 месяца назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Suppose arranging like 11, 10, 9, 8, 7, 5 ... in binary — 1011, 1010, 1001, 1000, 0111, 0110.....

as 4th bit not set of 5th number, xor of 4th and 5th will have 4th bit set.

no matter which way you arrange them you will always have to put two numbers where one of them has set left most bit and other one doesn't. so the ans is set left most bit and others are not set.

for the above example in binary — 1011, 1010, 1001, 1000, 0000, ..... would be the ans.