Working with Relations |
The wages of the employees of a company are computed on the basis of a set of relative rankings of the form x R y, where x and y are names and/or numbers, and R is a relational operator from the set {<, <=, >, >=, =}. The meaning of x R y is:
the salary of x | the salary of y | |
must be in relation R with | ||
number x | number y |
The problem is to compute the minimum and the maximum wage which each of the employees can get according to a given set of relations. It is known that: the name of an employee is at most 8 characters long; the wages are integers from 1 to 99999; only integer numbers appear in relations; the number of employees cannot exceed 100 and the number of relations is at most 1000.
Fido < 20 Bibo <= Fido Fred < Bibo 20 > Fred - 1 <= 3 1 = 1 - Fido < 20 Bibo < Fido 20 < Fido -
OK Bibo 2 19 Fido 2 19 Fred 1 18 OK No solution