P9539 "AWOI Round 2 B" Tree Studies.
Background
HR has just finished a simple and pretty problem, and it wants to try this one. But it is too weak and cannot solve it. Can you help it?
Description
Construct a lowercase letter string of length $n$, such that its similarity with the given lowercase letter string $s$ of length $n$ is within the range $[l,r]$.
Define the similarity of two strings $a,b$ of length $n$ as $\sum^{n}_{i=1}[a_i=b_i]$.
You need to make the constructed string as small as possible in lexicographical order.
Input Format
The first line contains three positive integers $n,l,r$.
The next line contains a string, representing the given lowercase letter string $s$.
Output Format
Output one line containing a string, representing the lexicographically smallest feasible string you construct.
Explanation/Hint
**Constraints**
**This problem uses bundled tests.**
| Subtask ID | $n\leqslant$ | Special Property | Score |
| -----------: | -----------: | -----------: | -----------: |
| $1$ | $100$ | None | $20$ |
| $2$ | $10^6$ | A | $10$ |
| $3$ | $10^6$ | B | $10$ |
| $4$ | $10^6$ | None | $60$ |
Special Property A: $l=r=n$ or $l=0,r=n$.
Special Property B: Every character of $s$ is `a`, or every character is not `a`.
For $100\%$ of the testdata, $1 \leqslant n \leqslant 10^6$, $0 \leqslant l \leqslant r \leqslant n$, and the length of $s$ is $n$.
**Staff**
| $\text{Idea}$ | $\text{Data}$ | $\text{Check}$ | $\text{Solution}$ |
| :----------: | :----------: | :----------: | :----------: |
| [玄学OIER荷蒻](/user/671294) | [QwQ666\_666](/user/677609) & [玄学OIER荷蒻](/user/671294) | [QwQ666\_666](/user/677609)| [玄学OIER荷蒻](/user/671294) |
Translated by ChatGPT 5