diduk001

comparator

Oct 12th, 2020
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.39 KB | None | 0 0
  1. struct cmp  {
  2.     bool operator() (const pair <int, string> &a, const pair <int, string> &b) const {
  3.         if (a.first > b.first) {
  4.             return true;
  5.         }
  6.         else if (a.first < b.first) {
  7.             return false;
  8.         }
  9.         else if (a.second < b.second) {
  10.             return true;
  11.         }
  12.         return false;
  13.     }
  14. };
  15.  
  16. set <pair <int, string>, cmp> s;
Advertisement
Add Comment
Please, Sign In to add comment