Advertisement
Josif_tepe

Untitled

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