0112. Polynomial Equation

Имя входного файла: equation.in
Имя выходного файла: equation.out
Ограничение по времени: 2 min
Ограничение по памяти: 64 megabytes

You are given some polynomials P0, P1, …, Pm on four variables X, Y, Z and T. Your task is to test whether for all sets a=(x,y,z,t)∈C4 such that P1(x,y,z,t)=…=Pm(x,y,z,t)=0 the equality P0(x,y,z,t)=0 also holds.

Input file

The first line of the input file contains integer number m, 1 ≤ m ≤ 10. The rest of the input file contains polynomials P0, P1, …, Pm, separated by dot characters `.'. The total degree of each polynomial will not exceed 10, and all coefficients are integer numbers not exceeding 105 by their absolute values. The exact representation of polynomials is given by the following BNF:

Different tokens of input (with the exception of digits forming a <number>) are separated by any number of space and/or newline characters.

Output file

In the single line of output print either YES or NO (without quotes).

Examples:

equation.inequation.out
2 X^2 + 3*X*Y - 2Y^2 . X^4 . X^2 + Y^2 .YES


Источник: Petrozavodsk Summer 2003. Primary Contest, Sunday, August 24
Автор: Andrew Lopatin, Nick Durov

Обсудить       Отправить решение



Версия для печати