Rounded Convex Hull

Xem PDF

Điểm: 400 Thời gian: 1.0s Bộ nhớ: 256M Input: bàn phím Output: màn hình

On a 2D plane, there are \(N\) circles and \(M\) polygons. Find the perimeter of the convex hull of all these figures.

Input

  • The first line of input contains 2 integers \(N\) and \(M (0 \le N, M \le 10^5 , 1 \le N + M)\), the number of circles and
    polygons.

  • The next \(N\) lines, each has 3 numbers \(x_i , y_i\) and \(r_i\) which is the center of the circle and its radius \((|x_i|, |y_i| \le 5 × 10^4, 0 \le r_i \le 5 × 10^4)\).

  • The next \(M\) lines, each line start with an integer \(p_i (p_i ≥ 1)\), the number of vertices in the polygon followed by \(p_i\)
    pair of numbers \((x_i,1, y_i,1), ..., (x_i,p_i, y_i,p_i) (|x_{i,j}|, |y_{i,j}| \le 5 × 10^4)\).
    Total number of vertices on all polygons will
    not exceeed \(10^5\).

Output

  • Output the perimeter of the convex hull. The answer is considered correct if precision error is less than \(10^{−5}\)
    .

Example

Test 1

Input
3 2
-14.123000 -1.456000 5.789000
0.123000 14.456000 4.789000
-6.868686 20.456780 3.789285
1 5.123000 5.456000
2 6.879000 6.123000 7.456000 7.789000
Output
88.888888

Bình luận


  • 2
    haha_ts    2:33 p.m. 8 Tháng 1, 2022

    hựa, hack zữ 🙁