Please help with the closest pair problem

I am trying to solve the problem (CodeChef: Practical coding for everyone). In order to solve this problem, I need to first understand the closest pair problem. I didn’t like the editorial provided on CC discuss.

I found some resources but they are for distinct x and y values. I request you all to post or direct me towards a good editorial or tutorial.

Thanks in advance