| 45 | loc[n] = count, q[count++] = n; |
| 46 | if (fix) swim(count-1); } |
| 47 | void pop(bool fix = true) { |
| 48 | assert(count > 0); |
| 49 | loc[q[0]] = -1, q[0] = q[--count], loc[q[0]] = 0; |
| 50 | if (fix) sink(0); |
| 51 | } |
| 52 | int top() { assert(count > 0); return q[0]; } |
| 53 | void heapify() { for (int i = count - 1; i > 0; i--) |
| 54 | if (cmp(i, (i - 1) / 2)) swp(i, (i - 1) / 2); } |
no outgoing calls