No submission language available for this problem.
Description
You are given an array of n integers a1,a2,…,an.
You will perform q operations. In the i-th operation, you have a symbol si which is either "<" or ">" and a number xi.
You make a new array b such that bj=−aj if ajsixi and bj=aj otherwise (i.e. if si is '>', then all aj>xi will be flipped). After doing all these replacements, a is set to be b.
You want to know what your final array looks like after all operations.
The first line contains two integers n,q (1≤n,q≤105) — the number of integers and the number of queries.
The next line contains n integers a1,a2,…,an (−105≤ai≤105) — the numbers.
Each of the next q lines contains a character and an integer si,xi. (si∈{<,>},−105≤xi≤105) – the queries.
Print n integers c1,c2,…,cn representing the array after all operations.
The first line contains two integers n,q (1≤n,q≤105) — the number of integers and the number of queries.
The next line contains n integers a1,a2,…,an (−105≤ai≤105) — the numbers.
Each of the next q lines contains a character and an integer si,xi. (si∈{<,>},−105≤xi≤105) – the queries.
Output
Print n integers c1,c2,…,cn representing the array after all operations.
Samples
Note
In the first example, the array goes through the following changes:
- Initial: [−5,−4,−3,−2,−1,0,1,2,3,4,5]
- >2: [−5,−4,−3,−2,−1,0,1,2,−3,−4,−5]
- >−4: [−5,−4,3,2,1,0,−1,−2,3,−4,−5]
- <5: [5,4,−3,−2,−1,0,1,2,−3,4,5]