stl priority queue based on lower value first

前端 未结 6 1858
故里飘歌
故里飘歌 2020-12-18 15:35

I have a problem with stl priority queue.I want to have the priority queue in the increasing order,which is decreasing by default.Is there any way to do this in priority qu

6条回答
  •  天涯浪人
    2020-12-18 16:39

    You can just push values multiplying them by -1 so it will be stored in reverse order unlike the actual default order...and multiply the value with -1 again while retrieving data to get it in its actual form.

提交回复
热议问题