Unable to find the mistake ( C. Biathlon Div2 ) - Please Help

Problem Link :-C Biathlon
My Code :- My Code

Ive been struggling for 5 hours straight and I’m still not able to find the solution to and get an AC in the problem . You can get the question above .

Approach :
Taking input as a pair .
sorting the targets center .
Applying Binary Search to get , if the shot is hit or not …

I’m Not able to get the answer , somebody Please help .

At first glance, I can see that you are losing the initial order of the targets when you sort them, but the answer requires that you report the number of shots on each target in the same order in which they were given. Also I would not use the same variable name for the right limit of binary search (why don’t you just use lower_bound function?) and the radius of the target.

consider this circle -
center - (0,0)
radius - 1
point of shot - (1,1)
your code is considering this point inside but this point is outside the circle

basically your are checking whether the point is inside the ‘square’ or outside…just add one more condition that if distance between point and center is less than radius then the point is inside else it’s outside

I realized that , i forgot about it . Thank you for helping me .

Ya , I got to know my mistake , Will use lower bound for that , thanks for helping .