SP8421 BTCODE_C - Fun With Inequalities
Description
You are given 'n' inequalities. Each inequality is of one of the following 4 types:
Type 1: x > v
Type 2: x < v
Type 3: x = v
Type 4: x != v
where 'x' is a variable which can only take non-negative integral values.
Your task is to find the maximum number of inequalities which are satisfied for some value of 'x'. You are also required to find the minimum value of 'x' for which the maximum number of inequalities are satisfied.
Input Format
The first line of input contains a single integer 'n', denoting the total number of inequalities.
Each of the next 'n' lines contain 2 space separated integers t $ _{i} $ and v $ _{i} $ . t $ _{i} $ denotes the type of inequality and v $ _{i} $ denotes the value on the right hand side of the inequality.
Output Format
Output two space separated integers, the first integer denoting the maximum number of inequalities which are satisfied for some value of 'x', and the second integer denoting the minimum value of 'x' for which the maximum number of inequalities are satisfied.