SP6829 POLYNOM - Polynomial
Description
The number of spectators at the FIFA World Cup increases year after year. As you sell the advertisement slots during the games for the coming years, you need to come up with the price a company has to pay in order to get an advertisement slot. For this, you need a good estimate for the number of spectators in the coming games, based on the number of spectators in the past games.
Your intuition tells you that maybe the number of spectators could be modeled precisely by a polynomial of degree at most _3_. The task is to check if this intuition is true.
Input Format
The input starts with a positive integer _N_, the number of test cases. Each test case consists of one line. The line starts with an integer _1 , followed by _n_ integers _x $ _{1} $ , ..., x $ _{n} $_ with _0 for all _i_, the number of spectators in past games.__
Output Format
For each test case, print **YES** if there is a polynomial _p_ (with real coefficients) of degree at most _3_ such that _p(i) = x $ _{i} $_ for all _i_. Otherwise, print **NO**.