#B. 光源

    Type: Default 2000ms 512MiB

光源

You cannot submit for this problem because the contest is ended. You can click "Open in Problem Set" to view this problem in normal mode.

题目描述

定义为由 nnnn 是奇数)个点 (xi,yi)(x_i,y_i) 以及 (x1,inf)(x_1,-\inf)(xn,inf)(x_n,-\inf) 组成的多边形。

定义山谷是这 nn 个点中的 (xi,yi)(x_i,y_i),要求 i1,in,i1(mod2)i\not=1,i\not=n,i\equiv1\pmod2

现您想在 y=hy=h 这条直线上放上一些点光源,使得所有的山谷都被照亮,照亮的条件是,从某个点光源连一条线段到山谷,这条线段不穿过山内部。

鉴于点光源是要钱的,您需要求出最少需要的点光源个数。

输入格式

第一行两个整数 n,hn,h

接下来 nn 行,一行两个整数 (xi,yi)(x_i,y_i)

输出格式

仅一行一个整数,表示最少需要的点光源个数。

9 6
0 0
1 2
3 0
6 3
8 1
9 2
11 1
12 4
14 0
1

image

9 5
-5 2
-4 3
-2 1
0 4
2 2
3 3
4 1
5 2
6 1
2

image

数据范围

对于所有子任务,有 3n<1063\le n<10^6n1(mod2)n\equiv1\pmod21h1061\le h\le 10^6106xi106-10^6\le x_i\le 10^60yi<h0\le y_i<hx1<x2<<xnx_1<x_2<\cdots<x_ny1<y2,y2>y3,y3<y4,,yn1>yny_1<y_2,y_2>y_3,y_3<y_4,\ldots,y_{n-1}>y_n

子任务编号 特殊限制 分值
11 y2=y4==yc1y_2=y_4=\cdots=y_{c-1} 2020
22 n<2×103n<2\times 10^3 3030
33 5050

COCI 21.2

Not Attended
Status
Done
Rule
IOI
Problem
3
Start at
2023-7-7 14:15
End at
2023-7-7 17:15
Duration
3 hour(s)
Host
Partic.
18