The solution in editorial is not O(NLogK) tc instead it is O(N*K*Log(K))


#1

See we process all N*K elements and to extract min from pq it takes Log(K) tc.