on the axis of numbers, n We have n intervals. Each interval is one of the following 8…
- User
on the axis of numbers, n We have n intervals. Each interval is one of the following 8 modes:
Type 1. ( a , ∞ ) (a,∞) is the set of all numbers greater than a is a. Type 2. (
∞ , a ) (−∞,a) is the set of all numbers smaller than a is a. Type 3. [ a , ∞ ) [a,∞) the set of all numbers greater than or equal to a is a. Type 4. (
∞ , a ] (−∞,a] is the set of all smaller or equal numbers a is a. Type 5. ( a , b ) (a,b) The set of all numbers greater than a a and smaller than b b is Type 6. ( a , b ] (a,b] the set of all numbers greater than a a and smaller or equal b b is Type 7. [ a , b ) [a,b) The set of all numbers greater than or equal to a a and smaller than b b is Type 8. [ a , b ] [a,b] The set of all numbers greater than or equal to a a and smaller or equal b b is to you n n interval is given to one of the above 8 modes. We want you to join this n Display n intervals in the standard way.
The meaning of standard representation is to choose an infinite number of intervals from the above 8 modes and write them consecutively so that no two pairs are shared. Use the U (union) symbol to put two spans together. (To better understand the purpose of the question, pay attention to the examples.)
input In the first line of input, integer and positive number n n stands for the number of intervals.
1 ≤ n ≤ 100 , 000 1≤n≤100,000
in n In the next n line, you will be shown a range of 8 introduced types in each line. The given intervals are guaranteed to be valid and infinite. infinite value ( ∞ ∞) is displayed as inf in the input.
All the numbers present in the smaller input are equal 1 0 9 10 9 are
Score sub-issue n ≤ 500 n≤500 50 No additional limit of 50 output Print the union of these intervals in the standard way. Pay attention that the output intervals must be in order.
Example Sample entry 1 3 [-3, -1) (-2, 2) (4, 5) Plain text Sample output 1 [-3, 2) U (4, 5) Plain text Sample input 2 3 (-inf, 3) (3, 7) [7, inf) Plain text Sample output 2 (-inf, 3) U (3, inf) Plain text Sample entry 3 2 (1, 2) [2, 3) Plain text Sample output 3 (1, 3) Plain text Sample entry 4 2 (1, 2) (2, 3) Plain text Sample output 4 (1, 2) U (2, 3) write in c++
- Assistant