25502023-01-17 00:09:33kristofIntervallumXOR kihíváspython3Time limit exceeded 35/100560ms11932 KiB
#spagetti

pow2 = [1 << i for i in range(30)][::-1]
N = int(input())
i = 0
while i < N:
    i += 1
    x = int(input())
    if x % 4 == 0:
        xor = x
    if x % 4 == 1:
        xor = 1
    if x % 4 == 2:
        xor = x + 1
    if x % 4 == 3:
        xor = 0

    drop = xor
    for index in range(30):
        if pow2[index] ^ drop <= x:
#            print(index, pow2[index])
            drop ^= pow2[index]
    print(xor, xor ^ drop)
SubtaskSumTestVerdictTimeMemory
subtask10/0
1Accepted17ms11472 KiB
subtask215/15
2Accepted29ms11852 KiB
subtask30/15
3Time limit exceeded560ms4252 KiB
subtask420/20
4Accepted17ms11932 KiB
subtask50/50
5Time limit exceeded559ms4796 KiB
6Time limit exceeded556ms4968 KiB