def reconstructQueue(people):
people.sort(key=lambda x: (-x[0], x[1]))
res = []
for h, k in people:
res.insert(k, [h, k])
return res
l = [[7, 0], [4, 4], [7, 1], [5, 0], [6, 1], [5, 2]]
l.sort(key=lambda x: (-x[0], x[1])) # 二维数组排序
print(reconstructQueue(l))