### BITMASKS — FOR BEGINNERS - Codeforces

Check whether the jth object is in the subset (check whether jth bit is 1): use the bitwise AND operation T = A & (1 << j). If T = 0, then the j-th item of the set is off. If T != 0 (to be precise, T = (1 << j)), then the j-th item of the set is on. For example: A = 42 (base 10) = 101010 (base 2) j = 3, 1 << j = 001000 <- bit …

Get Price