Codeforces Round 581 (Div. 2) |
---|
Finished |
The only difference between easy and hard versions is the length of the string. You can hack this problem if you solve it. But you can hack the previous problem only if you solve both problems.
Kirk has a binary string $$$s$$$ (a string which consists of zeroes and ones) of length $$$n$$$ and he is asking you to find a binary string $$$t$$$ of the same length which satisfies the following conditions:
A non-decreasing subsequence of a string $$$p$$$ is a sequence of indices $$$i_1, i_2, \ldots, i_k$$$ such that $$$i_1 < i_2 < \ldots < i_k$$$ and $$$p_{i_1} \leq p_{i_2} \leq \ldots \leq p_{i_k}$$$. The length of the subsequence is $$$k$$$.
If there are multiple substrings which satisfy the conditions, output any.
The first line contains a binary string of length not more than $$$10^5$$$.
Output a binary string which satisfied the above conditions. If there are many such strings, output any of them.
110
010
010
010
0001111
0000000
0111001100111011101000
0011001100001011101000
In the first example:
The second example is similar to the first one.
Name |
---|