Consider two arbitrarily chosen horizontal lines. A trapezoid
Task
Determine the cardinality of the largest independent set of trapezoids (the largest set means the set
with most elements). Also find the count of different independent sets with maximum cardinality.
Find this count modulo
Input Specification
The first line of input contains one integer
Output Specification
The only line of output should contain two numbers separated by space: firstly, the cardinality of
the largest independent set; secondly, the count of different independent sets with maximum
cardinality modulo
Constraints
- If only the first number in the output is correct you will get
of the test score. of the tests will have
Sample Input
7
1 3 1 9
4 7 2 8
11 15 4 12
10 12 15 19
16 23 16 22
20 22 13 25
30 31 30 31
Sample Output
3 8
Explanation for Sample Output
The picture below is not an accurate representation. The trapezoids' top and bottom have been shifted up and down for visibility.
Comments