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?

# | User | Rating |
---|---|---|

1 | tourist | 3947 |

2 | jiangly | 3740 |

3 | Radewoosh | 3652 |

4 | Benq | 3626 |

5 | jqdai0815 | 3620 |

6 | orzdevinwang | 3612 |

7 | ecnerwala | 3587 |

8 | Geothermal | 3569 |

8 | cnnfls_csy | 3569 |

10 | ksun48 | 3485 |

# | User | Contrib. |
---|---|---|

1 | awoo | 162 |

2 | maomao90 | 160 |

3 | adamant | 156 |

4 | atcoder_official | 155 |

5 | nor | 153 |

5 | cry | 153 |

7 | maroonrk | 152 |

8 | SecondThread | 148 |

8 | -is-this-fft- | 148 |

10 | Petr | 146 |

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?

↑

↓

Codeforces (c) Copyright 2010-2024 Mike Mirzayanov

The only programming contests Web 2.0 platform

Server time: Aug/16/2024 07:51:51 (j1).

Desktop version, switch to mobile version.

Supported by

User lists

Name |
---|

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.