Polynomial sign

4

35 votes
Linear Algebra, Easy-Medium, Mathematics
Problem

Consider a polynomial function with integer coefficients: . Lets define . Someone really wants to know and . Please, help him to find the sign of these values. Note that can be zero.

Read more about sgn function on https://en.wikipedia.org/wiki/Sign_function.

Input format

The first line contains single integer n ().

The second line contains space separated integers () - the coefficients of polynomial.

Output format

Print two space separated integers and .

Note that these values can be only 1, 0 or 1.

Sample Input
1
-100 1
Sample Output
1 -1
Time Limit: 1
Memory Limit: 512
Source Limit:
Explanation
  • ,
  • ,
Editor Image

?