2297. Amount of New Area Painted Each Day

Hard
Array
Segment Tree
Ordered Set

Description

Hints

Hint 1
What’s a good way to keep track of intervals that you have already painted?
Hint 2
Create an array of all 1’s, and when you have painted an interval, set the values in that interval to 0.
Hint 3
Using this array, how can you quickly calculate the amount of new area that you paint on a given day?
Hint 4
Calculate the sum of the new array in the interval that you paint.

Statistics

Acceptance
55.6%
Submissions
58,843
Accepted
32,698