301853: CF350D. Looking for Owls

Memory Limit:256 MB Time Limit:2 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

Looking for Owls

题意翻译

### 题意简述 给出一些圆和线段。 定义一个“猫头鹰”是满足以下四个条件的一条线段和两个圆的集合。 1. 两个圆半径相等 1. 两个圆没有交点 1. 两个圆关于线段对称 1. 两个圆圆心的连线和线段有交点 请找出图上不同“猫头鹰”的数量。 ### 输入格式 第一行两个整数 $n$ 和 $m ( 1\le n\le 3·10^5,2\le m\le 1500)$。 接下来的 $n$ 行分别包含四个整数 $x_1,y_1,x_2,y_2$, 表示线段的两个端点的坐标。保证每条线段长度大于 $0$。 接下来的 $m$ 行分别包含三个整数 $x_i,y_i,r_i$, 表示第 $i$ 个圆的圆心坐标和半径长度。所有的坐标都是绝对值最大为 $10^4$ 的整数。圆的半径是一个最大 $10^4$ 的正整数。 ### 输出格式 输出一个数字 — 问题的答案。 对于C++,请不要使用 %lld 说明符输出 64 位整数。最好使用 cout 流或 %I64d 说明符。

题目描述

Emperor Palpatine loves owls very much. The emperor has some blueprints with the new Death Star, the blueprints contain $ n $ distinct segments and $ m $ distinct circles. We will consider the segments indexed from $ 1 $ to $ n $ in some way and the circles — indexed from $ 1 $ to $ m $ in some way. Palpatine defines an owl as a set of a pair of distinct circles $ (i,j) $ ( $ i<j $ ) and one segment $ k $ , such that: 1. circles $ i $ and $ j $ are symmetrical relatively to the straight line containing segment $ k $ ; 2. circles $ i $ and $ j $ don't have any common points; 3. circles $ i $ and $ j $ have the same radius; 4. segment $ k $ intersects the segment that connects the centers of circles $ i $ and $ j $ . Help Palpatine, count the number of distinct owls on the picture.

输入输出格式

输入格式


The first line contains two integers — $ n $ and $ m $ ( $ 1<=n<=3·10^{5} $ , $ 2<=m<=1500 $ ). The next $ n $ lines contain four integers each, $ x_{1} $ , $ y_{1} $ , $ x_{2} $ , $ y_{2} $ — the coordinates of the two endpoints of the segment. It's guaranteed that each segment has positive length. The next $ m $ lines contain three integers each, $ x_{i} $ , $ y_{i} $ , $ r_{i} $ — the coordinates of the center and the radius of the $ i $ -th circle. All coordinates are integers of at most $ 10^{4} $ in their absolute value. The radius is a positive integer of at most $ 10^{4} $ . It is guaranteed that all segments and all circles are dictinct.

输出格式


Print a single number — the answer to the problem. Please, do not use the %lld specifier to output 64-bit integers is С++. It is preferred to use the cout stream or the %I64d specifier.

输入输出样例

输入样例 #1

1 2
3 2 3 -2
0 0 2
6 0 2

输出样例 #1

1

输入样例 #2

3 2
0 0 0 1
0 -1 0 1
0 -1 0 0
2 0 1
-2 0 1

输出样例 #2

3

输入样例 #3

1 2
-1 0 1 0
-100 0 1
100 0 1

输出样例 #3

0

说明

Here's an owl from the first sample. The owl is sitting and waiting for you to count it. ![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF350D/61898774872e3a34e56e4869f77f49d1bd8725ed.png)

Input

题意翻译

### 题意简述 给出一些圆和线段。 定义一个“猫头鹰”是满足以下四个条件的一条线段和两个圆的集合。 1. 两个圆半径相等 1. 两个圆没有交点 1. 两个圆关于线段对称 1. 两个圆圆心的连线和线段有交点 请找出图上不同“猫头鹰”的数量。 ### 输入格式 第一行两个整数 $n$ 和 $m ( 1\le n\le 3·10^5,2\le m\le 1500)$。 接下来的 $n$ 行分别包含四个整数 $x_1,y_1,x_2,y_2$, 表示线段的两个端点的坐标。保证每条线段长度大于 $0$。 接下来的 $m$ 行分别包含三个整数 $x_i,y_i,r_i$, 表示第 $i$ 个圆的圆心坐标和半径长度。所有的坐标都是绝对值最大为 $10^4$ 的整数。圆的半径是一个最大 $10^4$ 的正整数。 ### 输出格式 输出一个数字 — 问题的答案。 对于C++,请不要使用 %lld 说明符输出 64 位整数。最好使用 cout 流或 %I64d 说明符。

加入题单

算法标签: