Advertisement
Josif_tepe

Untitled

Feb 28th, 2022
905
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 passed_nodes; // kolku e distancata
  4.     int mood;
  5.     node() {}
  6.     node(int _idx, int _passed_nodes, int _mood) {
  7.         idx = _idx;
  8.         passed_nodes = _passed_nodes;
  9.         mood = _mood;
  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(passed_nodes < tmp.passed_nodes) {
  20.             score1++;
  21.         }
  22.         else {
  23.             score2++;
  24.         }
  25.         return score1 < score2;
  26.     }
  27. };
  28.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement