Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- input()
- A=[int(c) for c in str(input()).split()]
- S=sorted(int(c) for c in str(input()).split())
- N,M = len(A),len(S)
- R=[]
- i,j=0,0
- while i<N or j<M:
- if i==N:
- R+=S[j:]
- j=M
- else:
- while j<M and S[j]<A[j]:
- R.append(S[j])
- j+=1
- R.append(A[i])
- i+=1
- for k in range(len(R)):
- print(k, end=" ")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement