Someone please tell me why my code doesnt show TLE for this bit masking question?


Question Link

Here the complexity of the bit masking code we would write would be O(n2^n) and this will be done t time. So O(tn*2^n).

Also, I’ve read somewhere that 2^20 operations take about 1 seconds. As our limit for n is 20 and t is 100, it should take approx 100 seconds right??

Why does my code take less than even 1 sec ?? My Solution Link :

Thanks a lot for taking out the time to read everything and to help me!!


You can perform at most 10^8 iterations in about a second. This also depends on the processor so usually 10^6 is considered the safer side.


Understood. Thanks a lot brother.