I have tried a lot to understand this problem from tutorials on codeforces but not getting, how to solve it? please help…
[https://codeforces.com/problemset/problem/1030/B]
So, do you know how to find, whether two points are on the same or opposite side of a line when the equation of a line and the two points are given? This is what happening here with four lines.
This is my solution.
1 Like
You are given the points (0,d) , (d,0) ,(n,nd) ,(nd,n). So you can easily find the equation of the lines through the points
 x+y=d
 x+y=2nd
 x+(y)=d

xy=d
So, if the given points need to be inside the points, they must either lie inside the area covered by these equations.
So you just need to just where the given points ai, bi lies from d to 2*nd and xy lies from d to d
1 Like
Thanks a lot bro
Thanks a lot sir,got your solution