P3055 [USACO12OPEN] Tied Down G

题目描述

As we all know, Bessie the cow likes nothing more than causing mischief on the farm. To keep her from causing too much trouble, Farmer John decides to tie Bessie down to a fence with a long rope. When viewed from above, the fence consists of N posts (1

输入格式

\* Line 1: Four space-separated integers: N, M, bx, by. \* Lines 2..1+N: Line i+1 contains the space-separated x and y coordinates of fence post i. \* Lines 2+N..2+N+M: Each of these M+1 lines contains, in sequence, the space-separated x and y coordinates of a point along the rope. The first and last points are always the same as Bessie's location (bx, by).

输出格式

\* Line 1: The minimum number of posts that need to be removed in order for Bessie to escape by running to the right.

说明/提示

There are two posts at (2,3) and (2,1). Bessie is at (6,1). The rope goes from (6,1) to (2,4) to (1,1), and so on, ending finally at (6,1). The shape of the rope is the same as in the figure above. Removing either post 1 or post 2 will allow Bessie to escape.