Too Many Segments (hard version)

Problem Name:
Too Many Segments (hard version)
Site:CodeForces
Links:
Tags:
Problem setters: