Https://ide.codingblocks.com/s/251949

its showing TLE IN one test case and other test case is passing

hello @J20APPPP0006
for each query of type 2 ,u are performing performing O(k) which is too much operation.

using max heap u can answer kth smallest in O(1). so use max heap in place of multiset
also use long long for distance .

approach ->
image

code->

https://ide.codingblocks.com/s/252122....one test case is not passing

image
take it as long long.
also in main declare x and y as long long.
reason is to avoid overflow

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.