I am getting WA https://ide.codingblocks.com/s/288100
Have a look at my code
hello @sshreya2912
ur logic was correct.
but u were not printing it correctly.
this is correct code for printing distances

check ur updated code here
hello @sshreya2912
ur logic was correct.
but u were not printing it correctly.
this is correct code for printing distances

check ur updated code here