#P8222. [WFOI - 02] I wanna escape the shadow(阴影)

    ID: 9163 远端评测题 1000ms 512MiB 尝试: 0 已通过: 0 难度: 8 上传者: 标签>洛谷原创O2优化凸包旋转卡壳其它技巧洛谷月赛双指针 two-pointer

[WFOI - 02] I wanna escape the shadow(阴影)

Background

Define adventure with death

You are the shadow to my life

The background suddenly became gloomy, but kid knows clearly: this is the darkest moment, and also the time right before dawn.

Problem Description

Now kid is inside a circle with center (0,0)(0,0) and radius rr, and has learned a new operation mklig(X,Y,Z) to remove the darkness, described as follows.

X,Y,ZX,Y,Z are three distinct points. Draw the rays XYXY and ZYZY, and let the two rays intersect the circle at d1,d2d_1,d_2. Then the region enclosed by the arc d1d2d_1d_2 and the segments Yd1Yd_1 and Yd2Yd_2 is lit up.

Now there are some points inside the circle. Let SS_{光} be the total lit area when the circle radius is rr. Now kid wants to know, when making limrSπr2\lim\limits_{r \to \infty} \dfrac{S_{光}}{\pi r^2} (which can be understood as when rr goes to infinity) as large as possible, what is the minimum number of mklig operations needed. You only need to output the answer; leave the remaining operations to €€£!

The testdata guarantees that no three points are collinear.

Input Format

This problem contains multiple test cases.

The first line contains an integer TT, the number of test cases.

For each test case:

The first line contains a positive integer nn.

The next nn lines each contain two integers, representing the xx and yy coordinates of a point.

Output Format

Output TT lines, each containing one integer, the answer.

1
3
0 0
0 2
-1 1
3

Hint

  • Sample Explanation

This problem uses bundled Subtasks for testing.

  • Subtask #0 (30pts)\texttt{Subtask \#0 (30pts)}: n=103n = 10^3 and the data is random.
  • Subtask #1 (30pts)\texttt{Subtask \#1 (30pts)}: n5n \le 5.
  • Subtask #2 (40pts)\texttt{Subtask \#2 (40pts)}: n106n \le 10^6.

Constraints: For each test point, it is guaranteed that T5T \le 5 and n106\sum n \le 10^6. The absolute value of each point’s coordinates does not exceed 10910^9.

Translated by ChatGPT 5