#P4460. [CQOI2018] 解锁屏幕
[CQOI2018] 解锁屏幕
Description
When drawing the line, you must also follow some rules:
- The number of connected points must be at least . That is, connecting only two or three points will be considered invalid.
- The segment between two points must be straight; it cannot bend.
- Each point can be “used” at most once and cannot be repeated. Here, “use” means your finger passes over a point and it turns green.
- A segment between two points cannot “pass over” another point, unless that point has already been “used” earlier.
For the last rule, see the explanation in the figure below. The two figures on the left violate the rule; the two on the right (namely $2 \rightarrow 4 \rightarrow 1 \rightarrow 3 \rightarrow 6$ and $6 \rightarrow 5 \rightarrow 4 \rightarrow 1 \rightarrow 9 \rightarrow 2$) do not violate the rule because, when “passing over” a point, that point has already been used.

Now engineers want to improve the unlock screen by increasing or decreasing the number of points and moving their positions, so it is no longer a grid, while keeping the drawing rules above unchanged.
Please compute how many line-drawing patterns on the new unlock screen satisfy the rules.
Input Format
The first line contains an integer , the number of points.
The next lines each contain two space-separated integers and , the coordinates of each point.
Output Format
Output a single line with the answer modulo .
4
0 0
1 1
2 2
3 3
8
4
0 0
0 1
0 2
1 0
18
Hint
Sample Explanation 1
Let the points be indexed to . The valid patterns are , , , , and their mirror images.
Constraints
- For of the testdata, .
- For of the testdata, , . All point coordinates are distinct.
Translated by ChatGPT 5
京公网安备 11011102002149号