Mathematics, Competitive Programming, Philosophy, Discrete Mathematics.
segment, store the starting index of the segment, the colour it was repainted with and the time it was repainted at. C++ sets are balanced binary search trees which support greatest-less-than-lookups, insertions and deletions with logarithmic complexity. For each colour we also store a list of