解题思路:
注意事项:
参考代码:
while True:
try:
a = []
N, M = map(int, input().split())
for i in range(N+M):
a.append(list(map(int, input().split())))
def func(list, k, j):
if k >= j:
return list
start = k
end = j
mid = list[k]
while k < j:
while list[j][0] >= mid[0] and k < j:
j -= 1
list[k] = list[j]
while list[k][0] <= mid[0] and k < j:
k += 1
list[j] = list[k]
list[k] = mid
func(list, start, k-1)
func(list, k + 1, end)
return list
func(a, 0, len(a)-1)
for i in range(len(a)):
print("%d %d" % (a[i][0], a[i][1]))
except:
break
0.0分
0 人评分