#P1652. 圆

Description

You are given nn circles, and it is guaranteed that any two circles do not intersect and are not tangent.

You are then given two points (x1,y1),(x2,y2)(x_1,y_1),(x_2,y_2), both guaranteed to be not on any circle. Now you want to draw a curve from (x1,y1)(x2,y2)(x_1,y_1) \to (x_2,y_2). What is the minimum number of times this curve must cross the boundaries of the circles?

Input Format

  • The first line contains an integer nn, the number of circles.
  • The second line contains nn integers, the xx-coordinates of the circles.
  • The third line contains nn integers, the yy-coordinates of the circles.
  • The fourth line contains nn integers, the radii rr of the circles.
  • The fifth line contains four integers x1,y1,x2,y2x_1,y_1,x_2,y_2.

Output Format

Output a single integer, the minimum number of times the curve must cross the boundaries of the circles.

7
1 -3 2 5 -4 12 12
1 -1 2 5 5 1 1
8 1 2 1 1 1 2
-5 1 12 1
3

Hint

Constraints

For 100%100\% of the testdata, 1n501 \le n \le 50, x,y1000|x|, |y| \le 1000, 1r10001 \le r \le 1000.

It is guaranteed that no two circles share any point.

Translated by ChatGPT 5