Friday, August 22, 2014

Lights


Problem Link : http://www.codechef.com/problems/LIGHT/

Idea : In this problem , we have to find out the maximum height where a plane can run totaly in light. The height must be remain among the 0 and 1000 , as problem statement says .  So we can easily find out the height doing binary search within the range of h=0 and h=1000 .
For each value , we have to cheak whether in that height the plane can run or not .
At first , we calculate the cut point of the line at a height , along with which line , the plane can run by each light . Given the half of an angle of each triangle . This is the way we can calculate the cut point with the help of trigonometric ratio of tangent .
Now we want to see that which points are consecutive .

if given L and R are in a region where the cut points are consecutive , our answer is true and otherwise not.

Following this formulation , we can find out the maximum height .

My Solution

No comments:

Post a Comment