排序
class Solution {
public:
ListNode* mergeKLists(vector<ListNode*>& lists) {
multiset<int> ms;
for(int i=0;i<lists.size();i++){
while(lists[i]){
ms.insert(lists[i]->val);
lists[i]=lists[i]->next;
}
}
ListNode* out=new ListNode();
auto a=out;
for(auto it=ms.begin();it!=ms.end();it++){
a->next=new ListNode(*it);
a=a->next;
}
return out->next;
}
};