struct cmpa{ bool operator ()(const int &i,const int &j){ return a[i]<a[j]; } };
用priority_queue<int,vector,cmpa>q的方式定义比较函数时,比较方式要相反
也就是说如果希望从大到小排序需要写成<号
关于自定义比较运算符
原文:https://www.cnblogs.com/White-star/p/11529890.html