Skip to content

Instantly share code, notes, and snippets.

@lb5160482
Created June 14, 2018 00:31
Show Gist options
  • Save lb5160482/f813d9d4502f50799b5d078af4cd2c13 to your computer and use it in GitHub Desktop.
Save lb5160482/f813d9d4502f50799b5d078af4cd2c13 to your computer and use it in GitHub Desktop.
C++ priority_queue overload comparison function
struct com{
bool operator()( T &t1, T &t2) {
if(t1.x != t2.x) {
return t1.x < t2.x -->按x降序
}
return t1.y > t2.y -->x相等时按y升序
}
};
priority_queue<T, vector<T>, com> que;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment