Hostel visit question

can u explain the sample input and output?

Hi @sktg99
The rocket distance between x1,y1 to x2,y2 = pow((x2-x1),2)+pow((y2-y1),2)
since we calculate distance from origin (0,0) this means x1=0,y1=0, distance = pow(x2,2) + pow(y2,2)
out of all the points given we have to print the 3rd smallest distance.
sample test case :
9 3
1 10 10 //distance from origin = 100+100 =200
1 9 9 // 162
1 -8 -8 // 128
2 // 3rd smallest = 200
1 7 7 // 98
2 // 3rd smallest = 162
1 6 6 // 72
1 5 5 // 50
2 // 3rd smallest = 98

Hope this helps
Mark resolved if satisfied :slight_smile:

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.