Jamshid Kazemi (who is known by the pseudonym Kamran Pouriai), has recently become a man…
- User
Jamshid Kazemi (who is known by the pseudonym Kamran Pouriai), has recently become a man and was released from prison. One day he was driving on Ayat Hashemi Rafsanjani highway when he suddenly saw the following mysterious ad from his favorite company, Snap, on a billboard.
Snap ad
After checking this advertisement for several weeks, Jamshid was able to solve this puzzle and by solving it, he reached the website address. After entering the site, he realized that he was the first person to solve the Snap puzzle and the site asked him to enter his information. Snape immediately called him and lured him in with an incredible offer.
In advertising a string consisting of two letters 0 0 and 1 1 is given and beautiful intervals are specified in it. We call a set of intervals beautiful if both intervals do not share with each other or one is completely inside the other. Jamshid realized that in one operation we can select a range and reverse the letters of that range (including two heads), if we do this, we can no longer perform an operation with this range or the ranges within it. For example, we can reverse the string 01101 and get 10110. We need to create the largest possible string (alphabetically speaking) (and then we need to find a password from this string that will lead us to a site, don't think about this part because only Jamshid can solve this puzzle!) . Help Jamshid find the largest possible string (alphabetically) that can be constructed for any string and any set of nice intervals on it.
input In the first line of the input respectively n n, the number of intervals we are allowed to invert and s s, the initial string that only from 0 0 and 1 1 has been formed. Then in line i i of n n the next line of two numbers l i l i and r i r i It is stated that the expression of the interval i i is th The input fields are guaranteed to be beautiful. 1 ≤ n ≤ 200
000 1≤n≤200 000 1 ≤ ∣ s ∣ ≤ 200
000 1≤∣s∣≤200 000 1 ≤ l i < r i ≤ ∣ s ∣ 1≤l i <r i ≤∣s∣
output On a single line of output, print the largest possible alphabetic string that can be constructed with permutations.
Example Sample entry 1 2 001100 2 3 2 5 Plain text Sample output 1 010100 Plain text Sample entry 2 3 1001101 1 7 3 6 5 6 Plain text Sample output 2 1101001 Plain text write in c++
- Assistant