25412023-01-16 21:35:05kristofIntervallumXOR kihíváspython3Runtime error 0/10018ms13132 KiB
N = int(input())

#* spagetti

for i in range(N):

    Max = [ 2**i for i in range()]
    
    def ListToInt(InputList):
        ReturnValue = 0
        for i, value in enumerate(InputList):
            if value == 1:
                ReturnValue += 2**(len(InputList)-i-1)
        
        return ReturnValue
    
    RangeTop = int(input())
    
    b = len(bin(RangeTop)[2:])
    OsszeszamlaloLista = [0 for i in range(b)]

    osszeg = 0

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

    KeresettSzamBinarisban = [0 for i in range(b)]

    for i, value in enumerate(OsszeszamlaloLista):
        if int(value) % 2 == 0 and value != 0:
            KeresettSzamBinarisban[i] = 1

        if ListToInt(KeresettSzamBinarisban) > RangeTop:
            KeresettSzamBinarisban[i] = 0 

    print(osszeg, osszeg^ListToInt(KeresettSzamBinarisban))

	

#! x = 1
#! Max = [ x += x for i in range(b)]


SubtaskSumTestVerdictTimeMemory
subtask10/0
1Runtime error18ms11816 KiB
subtask20/15
2Runtime error17ms12128 KiB
subtask30/15
3Runtime error17ms12392 KiB
subtask40/20
4Runtime error17ms12656 KiB
subtask50/50
5Runtime error17ms12896 KiB
6Runtime error17ms13132 KiB