A1018 | Permutation--Gold
来源USACO
时间限制1s
内存限制128MB
通过 / 提交0/0
题目描述
Bessie has $N$ ($3\le N\le 40$) favorite distinct points on a 2D grid, no
three of which are collinear. For each $1\le i\le N$, the $i$-th point is
denoted by two integers $x_i$ and $y_i$ ($0\le x_i,y_i\le 10^4$).
Bessie draws some segments between the points as follows.
1. She chooses some permutation $p_1,p_2,\ldots,p_N$ of the $N$ points.
2. She draws segments between $p_1$ and $p_2$, $p_2$ and $p_3$, and $p_3$ and $p_1$.
3. Then for each integer $i$ from $4$ to $N$ in order, she draws a line segment from $p_i$ to $p_j$ for all $j<i$ such that the segment does not intersect any previously drawn segments (aside from at endpoints).
Bessie notices that for each $i$, she drew exactly three new segments. Compute
the number of permutations Bessie could have chosen on step 1 that would
satisfy this property, modulo $10^9+7$.
three of which are collinear. For each $1\le i\le N$, the $i$-th point is
denoted by two integers $x_i$ and $y_i$ ($0\le x_i,y_i\le 10^4$).
Bessie draws some segments between the points as follows.
1. She chooses some permutation $p_1,p_2,\ldots,p_N$ of the $N$ points.
2. She draws segments between $p_1$ and $p_2$, $p_2$ and $p_3$, and $p_3$ and $p_1$.
3. Then for each integer $i$ from $4$ to $N$ in order, she draws a line segment from $p_i$ to $p_j$ for all $j<i$ such that the segment does not intersect any previously drawn segments (aside from at endpoints).
Bessie notices that for each $i$, she drew exactly three new segments. Compute
the number of permutations Bessie could have chosen on step 1 that would
satisfy this property, modulo $10^9+7$.
输入格式
The first line contains $N$.
Followed by $N$ lines, each containing two space-separated integers $x_i$ and
$y_i$.
Followed by $N$ lines, each containing two space-separated integers $x_i$ and
$y_i$.
输出格式
The number of permutations modulo $10^9+7$.
输入输出样例
输入 #1
4 0 0 0 4 1 1 1 2
输出 #1
0
No permutations work.
C++ 编辑器
输入
输出
可保存默认模板;新题优先使用已保存模板。
当前快捷键仅展示,暂不支持修改。
- 撤销
Ctrl / ⌘ + Z - 重做
Ctrl / ⌘ + Y - 查找
Ctrl / ⌘ + F - 全选
Ctrl / ⌘ + A - 复制
Ctrl / ⌘ + C - 剪切
Ctrl / ⌘ + X - 粘贴
Ctrl / ⌘ + V - 自动排版
工具栏排版按钮 - 草稿保存
编辑时自动保存到本机
历史
提交记录
状态说明时间源码
AI
作答助手
你好,我是作答助手。可以问思路、复杂度、样例含义或代码报错原因;不会直接给出完整 AC 代码。
确定要清空代码吗?
提交通过
评测结果:Accepted