can somebody explain why am i getting tle in for this solution of problem D in cf educational round 78 https://www.ideone.com/5F6MKs
my solution complexity is nlogn .
link to problem:https://codeforces.com/contest/1278/problem/D
i used the idea of sweep line algorithm to connect the segments till it reaches n-1 edges.
after that i check for cyclicity of the graph.
in sweep line algo:
1)i process througth all the end points in ascending order.
2)if a segment is starting at this point i am making edges between the active segments which has finishing point less than the current segment and the current segment and i am adding the current segment to active segments.
3) if a segment is ending at this point i am just deleting it from active segments.