Approach hintTry it first, then revealHide
Serve one waiter from a FIFO pointer and the other from a max-heap ordered by money, then by arrival. Mark customers as served and lazily skip served entries in both structures.
Serve one waiter from a FIFO pointer and the other from a max-heap ordered by money, then by arrival. Mark customers as served and lazily skip served entries in both structures.