Hi all :)
For this problem, I used ternary search to find the best point on the west for each point on the east. The best point a[j] for a specific point b[i], is the point which makes the shortest path between the villages and goes from b[i]. Then, the minimum among these numbers, is the answer. Using ternary search is appropriate because the distance between the villages using the specific point b[i] and the points on the left, make an unimodal function.
But, My code for probelem "Building Bridge" has got RE.
I couldn't understand where the problem is. This is my code. Can anyone help me?
The test your program fails is rather small so you can simply launch it on your PC to see what's going wrong.
I did so. But didn't find what's going wrong.
I think the mistake is that your declare MIN[n] instead of MIN[m].
Yes, you are right. thank you very much :)
You should use a debugger program or debugging output.
What do you mean from debugger program?
thx. I got it :)