25962023-01-17 21:03:28kristofIntervallumXOR kihíváspython3Time limit exceeded 35/100601ms12608 KiB
from sys import stdin, stdout
import sys
import os
pow2 = [1 << i for i in range(30)][::-1]
mm = pow2[0]
N = int(input())
x = [int(stdin.readline()) for i in range(N)]
# max = 20000
# if N > max: N = max
all = ""
i = 0
while i < N:
    xx = x[i]
    aa = xx % 4
    if aa == 0 : xor = xx
    if aa == 1 : xor = 1
    if aa == 2 : xor = xx + 1
    if aa == 3 : xor = 0
    drop = xor
    m = mm
    for index in range(30):
        if m ^ drop <= xx:
            drop ^= m
        m >>= 1
    print(xor, xor ^ drop, flush=True)
    #all = all + str(xor) + " " + str(xor ^ drop) + "\n"
    # sys.stdout.write(str(xor) + " " + str(xor ^ drop) + "\n")
    i += 1
#sys.stdout.write(all)

SubtaskSumTestVerdictTimeMemory
subtask10/0
1Accepted17ms11668 KiB
subtask215/15
2Accepted30ms11444 KiB
subtask30/15
3Time limit exceeded556ms12204 KiB
subtask420/20
4Accepted17ms12196 KiB
subtask50/50
5Time limit exceeded601ms12408 KiB
6Time limit exceeded560ms12608 KiB