25552023-01-17 02:00:53kristofIntervallumXOR kihíváspython3Time limit exceeded 35/100577ms12772 KiB
#spagetti
from sys import stdin, stdout
import sys
pow2 = [1 << i for i in range(30)][::-1]
mm = pow2[0]
N = int(input())
x = [int(stdin.readline()) for i in range(N)]
for i in range(N):
    if x[i] % 4 == 0:
        xor = x[i]
    if x[i] % 4 == 1:
        xor = 1
    if x[i] % 4 == 2:
        xor = x[i] + 1
    if x[i] % 4 == 3:
        xor = 0
    drop = xor
    m = mm
    for index in range(30):
        if m ^ drop <= x[i]:
            drop ^= m
        m >>= 1
    #print(xor, xor ^ drop)
    sys.stdout.write(str(xor) + " " + str(xor ^ drop) + "\n")
SubtaskSumTestVerdictTimeMemory
subtask10/0
1Accepted17ms11436 KiB
subtask215/15
2Accepted28ms11668 KiB
subtask30/15
3Time limit exceeded577ms12284 KiB
subtask420/20
4Accepted17ms12120 KiB
subtask50/50
5Time limit exceeded564ms12772 KiB
6Time limit exceeded559ms12668 KiB