/** * Dodaje do kopca potencjalne nowe maksima, usuwając stare. */ uint64 repopulate(heap<coord> &h) { const coord current = h.pop(); /* Idź w górę. */ if (current.x + 1 == current.y) { h.push(coord(current.x, current.y - 1)); } /* Idź w lewo. */ if (current.x > 1) { h.push(coord(current.x - 1, current.y)); } return current.value(); }
bool operator >(coord other) const { return value() < other.value(); }
bool operator <(coord other) const { return value() > other.value(); }