Wow, The statement is very clear, you are given an array that contains number of positive integers and another array and also contains positive integers. Initially all the elements of are zero. You have three types of queries. The queries are:
1 l r s ( you have to update l to r like this and so on ).
2 l r s ( you have to update r to l like this and so on ).
3 u v ( you have to give the answer. Find how many numbers exist such that ).
Suppose and ( )
The first line of contains - number of elements in array
Next lines contain
Next line contains a positive integer - the number of queries.
Next lines contain the queries in the format given below.
First number of each of these line contains the query type or or .
In case of query type or , the next three numbers will be
for the query type and for the query type
In case of query type 3, the next two numbers will be .
See the sample test for a better understanding.
For each of the query type you have to print the answer to the query in separate lines.
Input | Output |
---|---|
4 2 3 4 6 4 1 2 3 1 2 2 4 3 3 2 4 3 1 1 | 4 0 |
Explanation:
Explanation of the 'st case.
Initially: { }
After the st query: { 0 , 2 , 3 , 0 }
After the nd query: B { }
,
So .
So the answer is