P29484 [洛谷] [COCI2013-2014#6] KRUŽNICE
提高
题目描述

Problem Description

Given $N$ circles centered on the $x$-axis with no intersections but possibly touching, how many regions do these circles divide the plane into?

Input Format

The first line of input contains an integer $N$, the number of circles.

The next $N$ lines each contain two integers $x_i$ and $r_i$, where $x_i$ is the $x$-coordinate of the $i$-th circle and $r_i$ is its radius.

All circles in the input are guaranteed to be unique.

Output Format

Output the number of regions the circles divide the plane into.

Sample Input and Output

Sample Input #1

2
1 3
5 1

Sample Output #1

3

Sample Input #2

3
2 2
1 1
3 1

Sample Output #2

5

Sample Input #3

4
7 5
-9 11
11 9
0 20

Sample Output #3

6

Notes

Sample Explanation

Sample 3 Explanation

This sample corresponds to the following diagram:

Data Constraints

  • For $40\%$ of the data, $1 \le N \le 5 \times 10^3$.
  • For $100\%$ of the data, $1 \le N \le 3 \times 10^5$, $-10^9 \le x_i \le 10^9$, $1 \le r_i \le 10^9$.

Source

Translated from COCI2013-2014 CONTEST #6 T4 KRUŽNICE.

输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
2 1 3 5 1
样例输出
3