Vlad and Division -> Help with this

Revision en2, by saiteja_0712, 2024-02-20 16:35:14

Problem link : https://codeforces.net/contest/1926/problem/D Submission : 247469924

My Approach Here I tried to make the groups of 2 integers whose xor will be 0. If we consider number of bits=3 then max possible number in binary = 111(7) and after flipping the bits it will be 000(0). lets take a number 101(5) after flipping bits it will be 010(2) (as we are considering only 3 bits) then i concluded to get the number after flipping the bits we should do (maxPossibleNumber — currNumber) -> this gives the number after flip. In the same way I formed the groups for 11 bits maxnum=2147483647 for the given problem. But im getting TLE for this code. But unable to figure out why im getting TLE. Please help me out in this.

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en3 English saiteja_0712 2024-02-20 16:43:59 35 Tiny change: 'tting TLE.\nPlease ' -> 'tting TLE.Even though it is an O(N) approach.\nPlease '
en2 English saiteja_0712 2024-02-20 16:35:14 12 Tiny change: 'roblem/D\n [submissi' -> 'roblem/D\nSubmission : [submissi'
en1 English saiteja_0712 2024-02-20 16:34:11 784 Initial revision (published)