Processing math: 100%
Distance to polygon - MarisaOJ: Marisa Online Judge

Distance to polygon

Time limit: 1000 ms
Memory limit: 256 MB
Given a convex polygon of n vertices and a point A(x,y) locating outside of the polygon. Find the shortest distance from A to the polygon. ### Input - The first lines contains three integer n,x,y. - The next n lines, each line contains two integers x,y, which describes a vertex of the polygon. The points are listed in clockwise order. ### Output - Print the shorest distance. Your answer will be considered correct if its absolute or relative error does not exceed 10−3. In other words, your answer, x, will be compared to the correct answer, y. If |x−y|<10−3, then your answer will be considered correct. ### Constraints - 1≤n≤1000. - −109≤x,y≤109. ### Example Input: 300200222 Output: 1.4142