TopCoder

User's AC Ratio

NaN% (0/0)

Submission's AC Ratio

NaN% (0/0)

Tags

Description

All through history, some people have been interested in the solutions of polynomial equations. As
everybody knows, in the Middle Ages wizards were all around. They claimed to be able to find n
solutions to any (univariate) polynomial equation of degree n. Of course, they sometimes needed to
include some hocus-pocus like their magic number i, which they say is a solution to the equation
x2 + 1 = 0 (the second solution being −i).


But there are a few equations, for which most ordinary wizards failed to give n distinct solutions.
Only the oldest and wisest wizards tried to be clever and bubbled something about multiplicity of
roots – but nobody can possibly understand such excuses for finding fewer than n distinct roots.


Given a polynomial of degree n, find out if wizards can possibly find n distinct roots (including the
magic ones using i), or if it is impossible — even for the wizards — to find n distinct roots.

Input Format

Input starts with the number of test cases t (1 ≤ t ≤ 100) in a single line. Each test case consists
of a single line that holds a series of integers (separated by single spaces). The first integer is the
degree n (0 ≤ n ≤ 10) of the polynomial in question. It is followed by the n + 1 coefficients a0 . . . an
(−30 ≤ ai ≤ 30, a0 != 0) to form the equation Sum(i=0..n) ai xn−i = 0.

Output Format

For each test case output “Yes!” on a single line (without the quotes) if the wizards have a chance
(provided they are as good as they claim) to find n distinct roots.


Print “No!” on a single line (again without quotes) if there is no way any wizard can possibly find
n distinct roots.

Sample Input 1

5
2 1 1 1
2 1 2 1
4 1 2 1 2 1
4 1 2 2 2 1
4 1 0 2 0 1

Sample Output 1

Yes!
No!
Yes!
No!
No!

Hints

Problem Source

Migrated from old NTUJ.

SWERC 2008

Subtasks

No. Testdata Range Score

Testdata and Limits

No. Time Limit (ms) Memory Limit (VSS, KiB) Output Limit (KiB) Subtasks
0 10000 65536 200