优先队列默认由大到小,由小到大可以为 priority_queue<int,vector<int>,greater<int> > q;
typedef struct node { int pi; int di; bool operator < (const node &b)const { if(pi == b.pi) return di > b.di; else return pi > b.pi; } } stone;