[USACO 2016 Dec G]Lasers and Mirrors
题号:NC24116
时间限制:C/C++/Rust/Pascal 1秒,其他语言2秒
空间限制:C/C++/Rust/Pascal 32 M,其他语言64 M
64bit IO Format: %lld

题目描述

二维平面内有N(N≤10^6)个点,有一个激光发射器和一个接收器。现在要在点上安装镜子(光线只能垂直于坐标轴),问最少安装几个镜子才能让接收器收到激光 ,或不可能。

输入描述:

The first line of input contains 5 space-separated integers: N,xL,yL,xB,yB, where (xL,yL) is the location of the laser and (xB,yB) is the location of the barn. All coordinates are between 0 and 1,000,000,000.
The next N lines each contain the x and y locations of a fence post, both integers in the range 0…1,000,000,000.

输出描述:

Please output the minimum number of mirrors needed to direct the laser to the barn, or -1 if this is impossible to do.
示例1

输入

复制
4 0 0 7 2
3 2
0 2
1 6
3 0

输出

复制
1