#A. 烽火

    Type: Default File IO: fire 1000ms 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.

烽火(fire\texttt{fire}

【题目描述】

长城上有 nn 个烽火台,第 ii 个烽火台的亮度为 aia_i,位置为 pip_i

如果第 ii 个烽火台燃起烽火,那么所有满足 pipjaiaj|p_i-p_j|\le a_i-a_jjj 号烽火台也会燃起烽火。

总司令要求小 D 算出至少要点燃几个烽火台的烽火,才可以使得每个烽火台都被点燃。

【输入格式】

fire.in\texttt{fire.in} 中读入数据。

第一行一个整数 nn

接下来 nn 行每行两个整数 pi,aip_i,a_i

【输出格式】

输出到 fire.out\texttt{fire.out} 中。

一行一个整数表示答案。

【样例 1 输入】

4
4 2
2 3
3 4
6 5

【样例 1 输出】

2

【样例 1 解释】

点燃烽火台 3,43,4

【样例 2】

见下发文件中的 fire2.in\texttt{fire2.in}fire2.ans\texttt{fire2.ans}

该样例满足子任务 33 的限制。

【样例 3】

见下发文件中的 fire3.in\texttt{fire3.in}fire3.ans\texttt{fire3.ans}

该样例满足子任务 44 的限制。

【数据范围】

对于所有测试数据有:1n5×105,1ai,pi1091\le n\le 5\times 10^5,1\le a_i,p_i\le 10^9

子任务编号 分值 特殊限制
11 1010 所有 aia_i 相等
22 n16n\le 16
33 3030 n1000n\le 1000
44 5050 无特殊限制

NOIP2024 模拟赛(一)

Not Attended
Status
Done
Rule
OI
Problem
4
Start at
2024-8-3 7:50
End at
2024-8-3 12:05
Duration
4.3 hour(s)
Host
Partic.
28