题解 | #整型数组合并#
整型数组合并
https://www.nowcoder.com/practice/c4f11ea2c886429faf91decfaf6a310b
m = int(input())
mlist = list(map(int, input().split()))
mlist = sorted(set(mlist)) # 排序并去重
#print(mlist)
n = int(input())
nlist = list(map(int, input().split()))
nlist = sorted(set(nlist)) # 排序并去重
#print(nlist)
res = ''
i, j = 0, 0
while i < len(mlist) and j < len(nlist):
if mlist[i] < nlist[j]:
res += str(mlist[i])
i += 1
elif mlist[i] > nlist[j]:
res += str(nlist[j])
j += 1
else:
res += str(mlist[i]) # 两者相等,添加任意一个
i += 1
j += 1
# 直接添加剩余元素(如果有的话,由于列表已排序,这里只会添加一个列表的剩余部分)
res += "".join(map(str, mlist[i:])) + "".join(map(str, nlist[j:]))
print(res)


