Sort by

recency

|

67 Discussions

|

  • + 0 comments

    The problem says that we have a number n. The possible generated numbers from n are 0 to 2^N - 1. Lets say this value is x.

    power set of x will generate 2 ^ x sets.

    xor is a modulo 2 sum i.e. sum all the elements and take its xor. if the sum is even then it will generate 0 otherwise 1.

    from the 2^x sets, half will generate even sum and half will generate odd.

  • + 0 comments

    There are 2^(2^n) subsets of S, and a moment's thought will convince you that the xor values are uniformly distributed across the 2^n possible values. So the answer we're looking for is 2^((2^n)-n)%M. Calculating that naively (even with pow) will get you a TLE because the exponent gets excessive for large n. But, since M is prime, we can use Fermat's Little Theorem to reduce the modulus of the exponent mod M-1and wind up with values that pow can deal with in the time limit.

    M = 10**9+7
    def solve(n):
        exp = pow(2,n,M-1)
        return pow(2,exp-n,M)
    
  • + 0 comments

    one of the biggest and most common misconceptions is that females who have miscarriages are absolutely fine because they're able to get pregnant. However, having multiple miscarriages is a certain type of fertility problem that affects some couples, making it vital to visit the Australian fertility centre Karachi.

  • + 0 comments

    Jaase UK Faison has been making the Southeast a better place for 50 years through real estate investment and acquisition.

  • + 0 comments

    The Tutor academy in Karachi offers a range of courses and programs to help students develop their reading, writing, math, sciences, business skills, and more. Our tutors are experienced professionals with various degrees who will work with you to boost your education goals.