You can have a look at my solution by using above link in the editorial…
I have uploaded my solution… (Author’s code link)
i didn’t understood the last part of …answer[minima]++, answer[maxima+1]–…blah, How can we answer the queries ? its quiet abstract please explain…
Use a smart way to update each of values from min to max…
i.e. one of the technique could be…
d[min]++;
d[max+1]–;
For each pair of circle…
Then do
d[i]+=d[i-1]
For each index in d…
This technique will excecute following code indirectly…
For i=min to max
d[i]++;