#mn7709. Tenzing and Triangle
Tenzing and Triangle
Tenzing and Triangle
时间限制:2 秒 / 内存限制:256 MB
Description
已知在平面直角坐标系中有 个点,其中第 个点位于 且权值为 ,并且有 ,且 ,其中 是一个常数。
现在,丁真同学想要删掉这 个点,有两种删点方法:
- 选择一个点 删去,代价为 。
- 任选一个点 ,这个点要满足 ,且 ,删除所有满足 的点,代价为 ,其中 为 与 的交点形成的等腰直角三角形的直角边长。
Input
- 第一行包含三个正整数 和 (, ),分别表示点的数量和常数 。
- 接下来 行,每行包含三个整数 (,),分别表示第 个点的坐标和权值。
Output
输出一个整数,表示最小的代价。
Example
Sample Input 1
4 6 1
1 2 1
2 1 1
1 1 1
3 2 6
Sample Output 1
4
Sample Input 2
6 7 1
4 2 1
3 3 1
5 1 4
3 2 5
4 1 1
0 6 4
Sample Output 2
4
Sample Input 3
10 4 100
0 0 1
0 1 1
0 2 50
0 3 200
1 0 1
1 1 1
1 2 1
2 0 200
2 1 200
3 0 200
Sample Output 3
355
相关
在下列比赛中: