#P4460. [CQOI2018] 解锁屏幕

    ID: 3389 远端评测题 1000ms 500MiB 尝试: 0 已通过: 0 难度: 7 上传者: 标签>动态规划,dp2018重庆各省省选广度优先搜索,BFS状态压缩,状压

[CQOI2018] 解锁屏幕

Description

When drawing the line, you must also follow some rules:

  1. The number of connected points must be at least 44. That is, connecting only two or three points will be considered invalid.
  2. The segment between two points must be straight; it cannot bend.
  3. 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.
  4. 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 3×33 \times 3 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 nn, the number of points.

The next nn lines each contain two space-separated integers xix_i and yiy_i, the coordinates of each point.

Output Format

Output a single line with the answer modulo 108+710^8+7.

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 44 points be indexed 11 to 44. The valid patterns are 12341 \rightarrow 2 \rightarrow 3 \rightarrow 4, 21342 \rightarrow 1 \rightarrow 3 \rightarrow 4, 32143 \rightarrow 2 \rightarrow 1 \rightarrow 4, 23142 \rightarrow 3 \rightarrow 1 \rightarrow 4, and their mirror images.

Constraints

  • For 30%30\% of the testdata, 1n101 \le n \le 10.
  • For 100%100\% of the testdata, 1000xi,yi1000-1000 \le x_i, y_i \le 1000, 1n<201 \le n < 20. All point coordinates are distinct.

Translated by ChatGPT 5