310252: CF1805C. Place for a Selfie

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

Description

C. Place for a Selfietime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard output

The universe is a coordinate plane. There are $n$ space highways, each of which is a straight line $y=kx$ passing through the origin $(0, 0)$. Also, there are $m$ asteroid belts on the plane, which we represent as open upwards parabolas, i. e. graphs of functions $y=ax^2+bx+c$, where $a > 0$.

You want to photograph each parabola. To do this, for each parabola you need to choose a line that does not intersect this parabola and does not touch it. You can select the same line for different parabolas. Please find such a line for each parabola, or determine that there is no such line.

Input

Each test contains multiple test cases. The first line contains the number of test cases $t$ ($1 \le t \le 10^4$). The description of the test cases follows.

The first line of each test case contains $2$ integers $n$ and $m$ ($1 \le n, m \le 10^5$) —the number of lines and parabolas, respectively.

Each of the next $n$ lines contains one integer $k$ ($|k| \le 10^8$), denoting a line that is described with the equation $y=kx$. The lines are not necessarily distinct, $k$ can be equal to $0$.

Each of the next $m$ lines contains $3$ integers $a$, $b$, and $c$ ($a, |b|, |c| \le 10^8$, $a > 0$) — coefficients of equations of the parabolas $ax^2+bx+c$. The parabolas are not necessarily distinct.

It is guaranteed that the sum $n$ over all test cases does not exceed $10^5$, and the sum $m$ over all test cases also does not exceed $10^5$.

Output

For each test case, output the answers for each parabola in the given order. If there is a line that does not intersect the given parabola and doesn't touch it, print on a separate line the word "YES", and then on a separate line the number $k$ — the coefficient of this line. If there are several answers, print any of them. If the line does not exist, print one word "NO".

You can output the answer in any case (upper or lower). For example, the strings "yEs", "yes", "Yes", and "YES" will be recognized as positive responses.

The empty lines in the output in the example are given only for illustration, you do not need to output them (but you can).

ExampleInput
5
1 2
1
1 -1 2
1 -1 3
2 2
1
4
1 2 1
2 5 1
1 1
0
1 0 0
1 1
100000000
100000000 100000000 100000000
2 3
0
2
2 2 1
1 -2 1
1 -2 -1
Output
YES
1
YES
1

YES
1
YES
4

NO

YES
100000000

YES
0
NO
NO
Note

In the first test case, both parabolas do not intersect the only given line $y=1\cdot x$, so the answer is two numbers $1$.

In the second test case, the line $y=x$ and the parabola $2x^2+5x+1$ intersect, and also the line $y=4x$ and the parabola $x^2+2x+1$ touch, so these pairs do not satisfy the condition. So for the first parabola, the answer is $1$ ($y=1x$), and for the second parabola — $4$.

In the third test set, the line and the parabola intersect, so the answer is "NO".

Input

题意翻译

给定 $n$ 个正比例函数 $y=kx$,再给出 $m$ 个下凸二次函数 $y=ax^2+bx+c(a>0)$,对于每个二次函数,从给定中找出一个一次函数,使得两函数图像没有交点。 $\sum n,\sum m\le 10^5$,$a,|b|,|c|,|k|\le 10^8$。

Output

题目大意:
宇宙是一个坐标平面。有 n 条空间高速公路,每条都是通过原点 (0,0) 的直线 y=kx。此外,平面上还有 m 个小行星带,我们将其表示为向上开口的抛物线,即函数 y=ax^2+bx+c 的图像,其中 a>0。

你想为每条抛物线拍照。为此,对于每条抛物线,你需要选择一条不与该抛物线相交也不接触的直线。你可以为不同的抛物线选择同一条直线。请为每条抛物线找到这样的直线,或者确定不存在这样的直线。

输入数据格式:
每个测试包含多个测试用例。第一行包含测试用例数 t (1≤t≤10^4)。接下来是测试用例的描述。

每个测试用例的第一行包含 2 个整数 n 和 m (1≤n,m≤10^5) —— 直线的数量和抛物线的数量。

接下来的 n 行中的每一行包含一个整数 k (|k|≤10^8),表示一条用方程 y=kx 描述的直线。直线不一定是唯一的,k 可以等于 0。

接下来的 m 行中的每一行包含 3 个整数 a、b 和 c (a, |b|, |c|≤10^8, a>0) —— 抛物线方程 ax^2+bx+c 的系数。抛物线不一定是唯一的。

保证所有测试用例的 n 之和不超过 10^5,m 之和也不超过 10^5。

输出数据格式:
对于每个测试用例,按给定的顺序输出每个抛物线的答案。如果存在一条不与给定抛物线相交也不接触的直线,请在单独的一行中打印单词 "YES",然后在单独的一行中打印这条直线的系数 k。如果有多个答案,打印其中任何一个。如果不存在这样的直线,打印一个单词 "NO"。

你可以以任何大小写输出答案。例如,字符串 "yEs"、"yes"、"Yes" 和 "YES" 将被识别为肯定响应。

输出中的空行仅为示例,你不需要输出它们(但可以输出)。题目大意: 宇宙是一个坐标平面。有 n 条空间高速公路,每条都是通过原点 (0,0) 的直线 y=kx。此外,平面上还有 m 个小行星带,我们将其表示为向上开口的抛物线,即函数 y=ax^2+bx+c 的图像,其中 a>0。 你想为每条抛物线拍照。为此,对于每条抛物线,你需要选择一条不与该抛物线相交也不接触的直线。你可以为不同的抛物线选择同一条直线。请为每条抛物线找到这样的直线,或者确定不存在这样的直线。 输入数据格式: 每个测试包含多个测试用例。第一行包含测试用例数 t (1≤t≤10^4)。接下来是测试用例的描述。 每个测试用例的第一行包含 2 个整数 n 和 m (1≤n,m≤10^5) —— 直线的数量和抛物线的数量。 接下来的 n 行中的每一行包含一个整数 k (|k|≤10^8),表示一条用方程 y=kx 描述的直线。直线不一定是唯一的,k 可以等于 0。 接下来的 m 行中的每一行包含 3 个整数 a、b 和 c (a, |b|, |c|≤10^8, a>0) —— 抛物线方程 ax^2+bx+c 的系数。抛物线不一定是唯一的。 保证所有测试用例的 n 之和不超过 10^5,m 之和也不超过 10^5。 输出数据格式: 对于每个测试用例,按给定的顺序输出每个抛物线的答案。如果存在一条不与给定抛物线相交也不接触的直线,请在单独的一行中打印单词 "YES",然后在单独的一行中打印这条直线的系数 k。如果有多个答案,打印其中任何一个。如果不存在这样的直线,打印一个单词 "NO"。 你可以以任何大小写输出答案。例如,字符串 "yEs"、"yes"、"Yes" 和 "YES" 将被识别为肯定响应。 输出中的空行仅为示例,你不需要输出它们(但可以输出)。

加入题单

算法标签: