Help with approach

prob: https://hack.codingblocks.com/app/contests/2022/1603/problem

code: https://ide.codingblocks.com/s/426195

this is the code for taking the input, I have created a vector for storing heads of all the linked lists , and made a function for inserting data in the ll

it is not showing any output when I pass any valid head to the print funciton

Hello @raghav007 this is the question based on priority queues in which first we will make the 2d array or vector and then taking the min element from row and pushing them in vector or array.

yeah but what about the linked list ? what is the need for 2D array ? we push the head of each linked lists in the priority queue and construct a linked list by pop from the pq right?

@raghav007 is this your approach or you have seen it from some editorial?

learnt from doubt class but there it was submitted on leetcode where the linked lists were already made

@raghav007 so you are facing problem in building linked list?

yes the vector of heads of linked lists is not working properly.

@raghav007 check this: