← Back to List

1524번: 세준세비 ↗

Solutions

Python 3
383 B | 383 chars
T = int(input())
for i in range(T):
    input()
    a,b=map(int,input().split())
    A = sorted(list(map(int,input().split())))
    B = sorted(list(map(int,input().split())))
    
    while a > 0 and b>0:
        if A[0] < B[0]:
            A.pop(0)
            a-=1
        else:
            B.pop(0)
            b-=1

    if a>0:
        print("S")
    elif b>0:
        print("B")