Soroush is waiting for one of his friends at the beginning of the queue to enter the…
- User
Soroush is waiting for one of his friends at the beginning of the queue to enter the cinema hall. Soroush's friend is standing at the end of the queue and is looking for him. except Soroush and his friend, n n other people are standing in the queue, between the two, starting from the beginning of the queue with numbers 1 to n n are numbered.
Considering that all these people came to the cinema just to spend time, instead of watching the movie, they decided to make Soroush and his friend unable to see each other.
At any moment, all the people in the queue are looking in the same direction. The direction of all people's gaze in every second is either towards Soroush and the beginning of the queue or towards his friend and the end of the queue. Every second each person increases their height by one centimeter if they see another person who is definitely taller than them in the direction they are looking.
Ali for a long time m It looks at this scene for m seconds and records the direction of people's gaze for each second. More precisely, he notes one English letter for each operation, which if it is equal to L, people per second i i th they look towards Sorush and the beginning of the queue, and if it is equal to R, people look towards Sorush's friend and the end of the queue in this second.
He is tall n He knows n people before starting the mentioned operations. More precisely, he knows the height of a person i i.m. before the start of operations h i h i It is centimeters. Write a program that calculates the final height of each person by having the initial height and the direction of people's gaze every second.
input In the first line, enter two natural numbers n n, the number of people in the queue, and m m is the number of seconds that Ali observed the said operation.
In the second input line n n number h 1 , h 2 , … , h n h 1 h 2 ,..., h n It is said that they show the initial height of people.
In the third line, enter a long string m m comes from the letters R and L, which is the letter i The ith of this string is the letter written in seconds i It shows i. 1 ≤ n , m ≤ 200
000 1 ≤ n, m ≤ 200 000 0 ≤ h i ≤ 1 0 9 0≤h i ≤10 9
output In the only exit line n n number print that number i Final height of a person i It shows i.
Sub-issues Constraint score subproblem 100 without additional restrictions Example Sample entry 1 5 2 1 3 1 3 1 RL Plain text Sample output 1 2 3 3 3 2 Plain text Sample input 2 5 4 5 4 3 2 1 LLRL Plain text Sample output 2 5 5 5 5 4
- Assistant