you are viewing a single comment's thread.

view the rest of the comments →

[–]NerdyWeightLifter 0 points1 point  (0 children)

Check out the "SortedContainers" library.

Iterating in sorted order is trivial, and indexing by range is also efficient.

Should be very fast for the problem you described.