27072023-01-18 23:06:49kristofIntervallumXOR kihíváspython3Time limit exceeded 15/100505ms13112 KiB
from sys import stdin, stdout
import sys
import os

def main() :

    N = 10000
    max = 1
    cnt = 1
    drop0 = 3
    xor_ary = [0 for i in range(N+1)]
    drop_ary = [0 for i in range(N+1)]

    for x in range(1,N) :
        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
        if x%2:
            drop = x
        else:
            drop = drop0
            cnt += 1
            if cnt > max :
                cnt = 1
                max += max
                drop0 = drop0 + drop0 + 1
        xor_ary[x] = xor
        drop_ary[x] = drop
        #print(x, xor, drop)

    N = int(input())
    for i in range(N) :
        if i > 120000 :
            exit(0)
        x = int(input()) 
        os.write(1, bytes(str(xor_ary[x]) + " " + str(drop_ary[x]) + "\n", 'ascii'))
#        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
#        if x%2 :
#            drop = x
#        else :
#            drop = x
#            while x != 0 :
#                x >>= 1
#                drop |= x
#        os.write(1, bytes(str(xor) + " " + str(drop) + "\n", 'ascii'))
#   print(xor, drop)

main()
SubtaskSumTestVerdictTimeMemory
subtask10/0
1Accepted23ms12100 KiB
subtask215/15
2Accepted25ms12620 KiB
subtask30/15
3Time limit exceeded505ms12852 KiB
subtask40/20
4Runtime error21ms12784 KiB
subtask50/50
5Runtime error21ms12708 KiB
6Runtime error24ms13112 KiB