118782024-11-15 14:37:48XetoxinoPingpongpypy3Futási hiba 0/10074ms23020 KiB
#N = int(input())
#P = [11,11,11]
#O = []
#for i in range (N):
    A, B = [int(i) for i in input().split()]
    if A > 43:
        P[-1] = 10
        P += [A%43,11]
        T = B - 22
        for i in range(2):
            if T > 9:
               O.append(10)
               T = T - 10
            elif B == 0:
                O.append(0)
            else:
                O.append(T)
                T = 0
        for i in range(2):
            O.append(11)
        if T > 9:
            O.append(10)
            T = T - 10
        elif B == 0:
            O.append(0)
        else:
            O.append(T)
            T = 0
    elif 44 > A > 33:
        P[-1] = A%33
        P.append(11)
        T = B - 11
        for i in range(2):
            if T > 9:
               O.append(10)
               T = T - 10
            elif B == 0:
                O.append(0)
            else:
                O.append(T)
                T = 0
        O.append(11)
        if T > 9:
            O.append(10)
            T = T - 10
        elif B == 0:
            O.append(0)
        else:
            O.append(T)
            T = 0
    else:
        T = B
        for i in range(3):
            if T > 9:
               O.append(10)
               T = T - 10
            elif B == 0:
                O.append(0)
            else:
                O.append(T)
                T = 0
    if 33 > A or A > 53:
        P = [-1]
        O = [-1]
    for i in range(len(P)):
        print(P[i], O[i])
    O = []
    P = [11,11,11]

N = int(input())

def nyer(X,db,m):
    XX = [11]*db
    X -= 11*db
    while X >= 10:
        XX += [10]
        X -= 10
    if X > 0:
        XX += [X]
    XX += [0]*(m-len(XX))
    return XX

for i in range(N):
    A,B = [int(i) for i in input().split()]
    if A == 33 and B <= 30:
        AA = nyer(A,3,3)[::-1]
        BB = nyer(B,0,3)
    elif 33 <= A <= 43 and 11 <= B <= 41:
        AA = nyer(A,3,4)[::-1]
        BB = nyer(B,1,4)
    elif 33 <= A <= 53 and 22 <= B <= 52:
        AA = nyer(A,3,5)[::-1]
        BB = nyer(B,2,5)
    else:
        AA = [-1]
        BB = [-1]
    for i in range(len(AA)):
        print(AA[i],BB[i])
    
RészfeladatÖsszpontTesztVerdiktIdőMemória
subtask10/0
1Futási hiba67ms23020 KiB
subtask20/20
2Futási hiba64ms22764 KiB
subtask30/30
3Futási hiba74ms22772 KiB
subtask40/50
4Futási hiba67ms22764 KiB
5Futási hiba72ms22804 KiB
6Futási hiba67ms22756 KiB