URBANDEV query about the idea

Yes. You are correct.

1 Like

Yes, twice.

1 Like

Actually I am scanning once but storing the required values in a and b just after scanning the values.For calculating vertical lines I am storing the required values in struct array a and for horizontal lines in struct array b.

[Here][1]
[1]: https://www.codechef.com/viewsolution/12067548
is my solution with sweep line + BIT, runs in 0.25 ms, I hope this can be helpfull.

R is used for reporting all the intersections in any segment.We does not require this.