#BS0000133. Chọn đường thẳng để chụp ảnh (Place for a Selfie)
Bài tập thuộc lộ trình
Mục lục đề ⌄
Chọn đường thẳng để chụp ảnh (Place for a Selfie)
Place for a Selfie
Source: Codeforces
Version: Phuoc Hung OJ Extended
Problem Statement
There are lines through the origin and upward-opening parabolas , with . For each parabola, find any of the given lines with no common point with that parabola, neither crossing nor tangent. A line may be used for multiple parabolas. If several coefficients work, output any of them; otherwise report impossibility.
Input
The first line contains . Each of the next lines contains a line coefficient . Each of the next lines contains three integers . Lines and parabolas may be repeated.
Output
For each parabola, print YES and on the next line one coefficient from the given lines if a valid line exists; otherwise print NO. Upper/lower case is accepted for these words. A special checker validates any correct choice.
Subtasks
- Subtask 1 (20 points): ; ; $|k_i|\le10^8;\ 1\le a_j\le10^8;\ |b_j|,|c_j|\le10^8$, , .
- Subtask 2 (30 points): ; ; $|k_i|\le10^8;\ 1\le a_j\le10^8;\ |b_j|,|c_j|\le10^8$, , .
- Subtask 3 (50 points): ; ; $|k_i|\le10^8;\ 1\le a_j\le10^8;\ |b_j|,|c_j|\le10^8$, , .
Examples
Input
2 3
1
4
1 2 1
2 5 1
1 0 0
Output
YES
1
YES
4
NO
Explanation
For , line yields discriminant , so it never meets the parabola. For , choosing gives . For , every line passes through the origin, which is on the parabola, so no line works. Output YES 1, YES 4, and NO on separate lines.