using priority queue, good