Advertisement
Josif_tepe

Untitled

Mar 2nd, 2022
1,076
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.54 KB | None | 0 0
  1. struct node {
  2.     int idx;
  3.     int mood;
  4.     int dist;
  5.     node (){}
  6.     node(int _idx, int _mood, int _dist) {
  7.         idx = _idx;
  8.         mood = _mood;
  9.         dist = _dist;
  10.     }
  11.     bool operator < (const node &tmp) const {
  12.         int score1 = 0, score2 = 0;
  13.         if(mood > tmp.mood) {
  14.             score1++;
  15.         }
  16.         else {
  17.             score2++;
  18.         }
  19.         if(dist < tmp.dist) {
  20.             score1++;
  21.         }
  22.         else {
  23.             score2++;
  24.         }
  25.         return score1 < score2;
  26.     }
  27. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement