#P6875. [COCI 2013/2014 #6] KRUŽNICE

[COCI 2013/2014 #6] KRUŽNICE

Problem Description

There are NN pairwise non-overlapping circles centered on the xx axis, but their circumferences may touch. How many regions do these circles divide the plane into?

Input Format

The first line contains an integer NN, the number of circles.

Each of the next NN lines contains two integers xix_i and rir_i, where xix_i is the xx coordinate of the center of the ii-th circle, and rir_i is its radius.

All circles in the input are guaranteed to be unique.

Output Format

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

2
1 3
5 1 
3
3
2 2
1 1
3 1 
5
4
7 5
-9 11
11 9
0 20 
6

Hint

Sample Explanation

Explanation for Sample 3

This sample corresponds to the figure below:

Constraints

  • For 40%40\% of the testdata, 1N5×1031 \le N \le 5\times 10^3.
  • For 100%100\% of the testdata, 1N3×1051 \le N \le 3\times 10^5, 109xi109-10^9 \leq x_i \leq 10^9, 1ri1091 \leq r_i \leq 10^9.

Notes

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

Translated by ChatGPT 5