import sys

n,m = map(int, sys.stdin.readline().split())

a = list(map(int, sys.stdin.readline().split()))
b = list(map(int, sys.stdin.readline().split()))

c = a + b
c.sort() # 리스트 정렬의 시간 복잡도는 일반적으로 O((n + m) log(n + m))

print(' '.join(map(str,c)))

 

>> 리스트 출력할 때 * 기호를 앞에 붙이면 join을 쓰지 않아도 편하게 출력이 가능한 듯??!!

*리스트 구문은 리스트의 요소들을 개별 인수로 언패킹하여 print 함수에 전달합니다.
이를 통해 리스트의 요소들이 공백으로 구분되어 출력됩니다.

 

+ Recent posts