A study in Bake Street

Hello, I was trying to solve ADADET… What I did is:
For each building starting from the first, I find the minimum value of tanx which is the heigths difference over the positions difference. If one of the tanx is lower than zero (Equivalent to say that the building is bigger) the minimum value is reset.
My code is here: My_Code
The problem is that I still get wrong answer and I dont know which case is failing, could somebody help me to figure out?

I really thank you

Update. I’ve already corrected the error but I’m getting time exceeded. If anyone can help me I’d be really grateful
New code: Updated

check for this input:-
1 130
65 110
120 40
160 60
240 100
280 65
320 120
from second building he should not be able to shoot at the building 7 because the height of 7th building is grater than the building no 2.

1 Like

Same Here. I Tried My Code on many different test-cases , all passing but on submission WA. Link to my Submission : https://www.codechef.com/viewsolution/14304164