#P5600. 【XR-4】尺规作图

    ID: 6354 远端评测题 1000ms 125MiB 尝试: 0 已通过: 0 难度: 9 上传者: 标签>提交答案Special JudgeO2优化洛谷月赛平面几何

【XR-4】尺规作图

Background

This is an output-only (human intelligence) problem.

Problem Description

You are given several known geometric objects, and you need to construct a required point using straightedge and compass. You must find this point within a limited number of steps.

You can perform the following operations:

  1. Draw a circle with one known point as the center and another known point as a point on the circle.

  2. Connect two known points to form a straight line.

You need to output your construction steps.

Input Format

The first line contains an integer, which is the test point ID.

The second line contains an integer nn, which is the number of known points.

The next nn lines each contain two real numbers xi,yix_i, y_i, which are the coordinates of the ii-th point.

Next is an integer n1n_1, which is the number of known line segments.

The next n1n_1 lines each contain two integers u,vu, v, meaning there is a line segment connecting point uu and point vv.

Next is an integer n2n_2, which is the number of known lines.

The next n2n_2 lines each contain two integers u,vu, v, meaning there is a line passing through point uu and point vv.

Next is an integer n3n_3, which is the number of known circles.

The next n3n_3 lines each contain two integers u,vu, v, meaning there is a circle centered at point uu, with point vv on the circle.

Next are two real numbers x,yx, y, which are the coordinates of the required point.

Next are 1010 integers a1a_1 to a10a_{10}, which are the scoring parameters for this test point. See the statement for details.

Output Format

The first line contains an integer mm, which is the number of steps you need.

The next mm lines describe your construction steps:

First an integer 11 or 22. 11 means you draw a circle, and 22 means you draw a straight line.

Then four real numbers x1,y1,x2,y2x_1, y_1, x_2, y_2:
If you draw a circle, it means you draw a circle centered at (x1,y1)(x_1, y_1) and with (x2,y2)(x_2, y_2) as a point on the circle.
If you draw a line, it means you connect (x1,y1)(x_1, y_1) and (x2,y2)(x_2, y_2).

2
0.0000000000 0.0000000000
0.0000000000 1.0000000000
1
1 2
0
0
0.8660254038 0.5000000000
11 10 9 8 7 6 5 4 3 2

2
1 0.0000000000 0.0000000000 0.0000000000 1.0000000000
1 0.0000000000 1.0000000000 0.0000000000 0.0000000000

Hint

For each test point, if your number of steps is less than or equal to the first ii scoring parameters, then you will get ii points.

Notes:

  1. All x,yx, y must be points you have already obtained. “Already obtained” means points from the input, or intersection points of known geometric objects. (That is, you cannot choose an arbitrary point to construct with, and you cannot obtain the required point by choosing some suitable point.)
    More precisely, each time you output a coordinate, the Special Judge will choose, among all points you have currently obtained, the point whose Euclidean distance to your input coordinate is the smallest, as the point you selected this time. If this smallest distance is greater than 10510^{-5}, then this operation will be judged invalid, and for this test point you will get 00 points.

  2. You cannot draw a circle from its center and radius. You can only draw a circle from its center and a point on the circle.

  3. Your constructed answer is considered correct if the absolute error or relative error to the required point is at most 10510^{-5} (because the author does not know how to write a Special Judge with no error).
    More precisely, suppose the point you obtained is (x1,y1)(x_1, y_1) and the required point is (x2,y2)(x_2, y_2). Then your output is considered correct if and only if x1x2max(x2,1)105\dfrac{|x_1-x_2|}{\max(|x_2|, 1)} \le 10^{-5} and y1y2max(y2,1)105\dfrac{|y_1-y_2|}{\max(|y_2|, 1)} \le 10^{-5}.

  4. The provided files data1.in to data10.in are the 1010 input datasets. Among them, test points 1,2,3,7,81, 2, 3, 7, 8 come with diagrams.

  5. The provided checker can compute your score. Usage is as follows (where data.in is the input file and data.out is your output file.):

  • Windows-32/64:
checker data.in data.out data.out
  • Linux/MacOS:
./checker data.in data.out data.out
  1. The problem setter cannot get 100100 points.

update: You can click here to view the checker source code. If you have ideas for improvements, feel free to suggest them.

Translated by ChatGPT 5