Merge K Sorted Lists - Priority Queue / Heap / Top K

My solution uses the same logic but with an array of indexes instead of structs:

std::vector<int> merge_k_sorted_lists(std::vector<std::vector<int>> lists) {
    std::priority_queue<int, std::vector<int>, std::greater<int>> mh;
    std::vector<int> idx(lists.size(), 0);
    for (const auto &l : lists) {
        mh.push(l[0]);
    }
    std::vector<int> res;
    while (mh.size()) {
        for (int i = 0; i < lists.size(); ++i) {
            while (idx[i] < lists[i].size() && lists[i][idx[i]] == mh.top()) {
                res.push_back(mh.top());
                mh.pop();
                if (++idx[i] < lists[i].size()) mh.push(lists[i][idx[i]]);
            }
        }
    }    
    return res;
}

l1 would be length n and heappop would be log(n), vs in the solution the heaps has k elements at max and heappop is log(k)