CF350D.Looking for Owls

提高+/省选-

通过率:0%

时间限制:2.00s

内存限制:256MB

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

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.

帕尔帕廷皇帝非常喜爱猫头鹰。皇帝拥有一些关于新型死星的设计图,这些设计图中包含 nn 条互不相同的线段和 mm 个互不相同的圆。我们将这些线段以某种方式编号为 11 至 nn,并将这些圆以某种方式编号为 11 至 mm。

帕尔帕廷将一只“猫头鹰”定义为一个三元组:一对互异的圆 (i, j)(i,\,j)(其中 i<ji < j)以及一条线段 kk,满足以下条件:

  1. 圆 ii 与圆 jj 关于包含线段 kk 的直线互为轴对称;
  2. 圆 ii 与圆 jj 无任何公共点;
  3. 圆 ii 与圆 jj 具有相同的半径;
  4. 线段 kk 与连接圆 ii 和圆 jj 圆心的线段相交。

请帮助帕尔帕廷计算图中不同的“猫头鹰”的数量。

输入格式

The first line contains two integers — n and m (1 ≤ n ≤ 3·105, 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 104 in their absolute value. The radius is a positive integer of at most 104.

It is guaranteed that all segments and all circles are dictinct.

第一行包含两个整数 nn 和 mm(1≤n≤3⋅1051 \leq n \leq 3 \cdot 10^5,2≤m≤15002 \leq m \leq 1500)。

接下来的 nn 行每行包含四个整数 x1,y1,x2,y2x_1, y_1, x_2, y_2 —— 表示线段两个端点的坐标。保证每条线段长度为正。

接下来的 mm 行每行包含三个整数 xi,yi,rix_i, y_i, r_i —— 表示第 ii 个圆的圆心坐标和半径。所有坐标的绝对值不超过 10410^4;半径为正整数,且不超过 10410^4。

保证所有线段互不相同,所有圆也互不相同。

输出格式

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.

输出一个整数——即该问题的答案。

请注意,在 C++ 中不要使用 %lld 格式说明符来输出 64 位整数。推荐使用 cout 流或 %I64d 格式说明符。

输入输出样例

  • 输入#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.

这是第一个样例中的猫头鹰。猫头鹰正坐着,等待你来数它。

输入解题思路,AI测评打分。不知道怎么写?

首页