• + 1 comment

    my python code:

    g = int(input().strip())
    
    for _ in range(g):
        n = int(input().strip())
        s = [int(x) for x in input().strip().split(' ')]
        x = 0
        for i in s:
            x ^= i
        if len(set(s))==1 and 1 in s:
            #here x=0 or 1
            if x:#odd no. of ones
                print("Second")
            else:#even no. of ones
                print("First")
        else:
            if x:
                print("First")
            else:
                print("Second")
    

    I don't understand that when the s(array containing the number of stones in piles) is not having only one, how can it be same as the normal nim game. I mean see this part:

       else:
            if x:
                print("First")
            else:
                print("Second")
    

    this is same for nim as well as misere nim, how is this possible?? when in nim last player to pick the stone wins but in misere nim he/she loses!!