Answer Link—
https://online.codingblocks.com/player/20796/content/5368?tab=submissions
HOTEL VISIT -----one test case giving tle HOW TO OPTIMISE
Solved on WhatsApp.
Marking it resolved.
my solution is workinf for testcases but it gives wrong answer on submitting now .
the link of new code is---------------
https://ide.codingblocks.com/s/69293
you are using
if(p.peek()>k)
here you have to use
if(p.peek()>f)
//Because f is new distance
Hit like if u get it 
1 Like
i corrected my mistake
still second test case could not be passed
Change int to long long int.
Cozz when u are doing xx + yy there it overflow integer range.
1 Like
Thanks resolved!!l 