25292023-01-16 17:52:16kristofIntervallumXOR kihíváspython3Wrong answer 0/100579ms12732 KiB
N = int(input())

for i in range(N):
    
    asd = int(input())
    
    a = [0 for i in range(len(str(bin(asd)[2:])))]
    b = len(bin(asd)[2:])

    for i in range(asd+1):
        for index, j in enumerate(str(bin(i)[2:]).zfill(b)):
            if j == "1":
                a[index] += 1 


    TempVar = [0 for i in range(len(a))]

    def ListToInt(InputList):
        ReturnValue = 0
        for i, value in enumerate(InputList):
            if value == 1:
                ReturnValue += 2**(len(InputList)-i-1)
        
        return ReturnValue
                



    for i, value in enumerate(a):
        if int(value) % 2 == 0 and value != 0:
            TempVar[i] += 1
        if ListToInt(TempVar) > asd:
            TempVar[i] -=1 


    a = 0
    Kihagyndo = ListToInt(TempVar)

    for i in range(asd+1):
        if i == Kihagyndo:
            continue
        else:
            a ^= i

    print(a)
SubtaskSumTestVerdictTimeMemory
subtask10/0
1Wrong answer18ms12732 KiB
subtask20/15
2Time limit exceeded579ms5008 KiB
subtask30/15
3Time limit exceeded563ms5172 KiB
subtask40/20
4Time limit exceeded554ms5348 KiB
subtask50/50
5Time limit exceeded578ms5588 KiB
6Time limit exceeded578ms5616 KiB