All Tracks Math Problem

Polynomial sign
/

Easy-Medium, Linear Algebra, Mathematics

Problem
Editorial
Analytics

Consider a polynomial function \(f(x)\) with integer coefficients: \(a_0 + a_1 \cdot x + ... + a_n \cdot x^n\). Lets define \(superBig = 10000^{10000^{10000}}\). Someone really wants to know \(sgn(f(superBig))\) and \(sgn(f(-superBig))\). Please, help him to find the sign of these values. Note that \(a_n\) 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 (\(0 \leq n \leq 3 \cdot 10^5\)).

The second line contains \(n+1\) space separated integers \(a_i\) (\(-10^{18} \leq a_i \leq 10^{18}\)) - the coefficients of polynomial.

Output format

Print two space separated integers \(sgn(f(superBig))\) and \(sgn(f(-superBig))\).

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

SAMPLE INPUT
1
-100 1
SAMPLE OUTPUT
1 -1
Explanation
  • \(sgn(f(superBig)) =sgn(superBig - 100) = 1\), \(superBig - 100 > 0\)
  • \(sgn(f(-superBig)) =sgn(-superBig - 100) = -1\), \(-superBig - 100 < 0\)
Time Limit: 1.0 sec(s) for each input file.
Memory Limit: 512 MB
Source Limit: 1024 KB

Best Submission

Similar Problems

Contributors

This Problem was Asked in

Initializing Code Editor...
Notifications
View All Notifications

?