Author: | A. Baranov | Time limit: | 1 sec | |
Input file: | Standard input | Memory limit: | 256 Mb | |
Output file: | Standard output |
Let's consider a function of the following form: F(X, Y) = AB ⋅ X + CD ⋅ Y.
The task is to find integer values for A, B, C and D, such that for a given set of points (Xi, Yi)
the specified function satisfies pre-determined conditions:
RoundDawn(F(Xi, Yi)) = Zi or RoundUp(F(Xi, Yi)) = Zi,
where RoundDawn() и RoundUp() — denote rounding down and rounding up, respectively.
The input begins with the number N, followed by N conditions, each written in the following format.
First, the operation sign is indicated: '>' for RoundDawn or '<' for RoundUp.
Then, three integers follow: Xi, Yi, Zi.
If the problem has a solution, the output contains the number 1,
followed by the found values of A, B, C and D.
If there is more than one solution, any of them can be output.
If there is no solution, the output is the single number 0.
All input values are integers.
− 40 ≤ (Xi, Yi, Zi) ≤ 40, 0 < N ≤ 2000
No. | Standard input | Standard output |
---|---|---|
1 |
|
|
2 |
|
|