luogu#P4119. [Ynoi2018] 未来日记
[Ynoi2018] 未来日记
Background
So, Xiaoxue’s (pinyin) future belongs to Yuno’s~

Hmm... I know what your future will be like.
Listen up, I am Yuno Gasai.

Because Xiaoxue changed the future, the three of them could be together...
Why...
That makes me the bad guy...

I won’t stab.
Because... this is the future.
This... is my home.

Problem Description
Yuno Gasai gave you a sequence of length , with operations.
- Replace all occurrences of with within the interval .
- Query the -th smallest value within the interval .
Input Format
The first line contains two integers and .
The second line contains integers representing the sequence .
The next lines:
1 l r x y: Replace all in with .
2 l r k: Query the -th smallest value in .
Output Format
For each query, output one integer as the answer.
3 3
2 3 3
2 1 3 1
1 1 3 3 1
2 1 3 2
2
1
Hint
Idea: f321dd, Solution: f321dd & nzhtl1477, Code: nzhtl1477 & Claris, testdata: nzhtl1477 & Juan_feng.
Constraints: .
By f321dd & nzhtl1477 & Claris.
Translated by ChatGPT 5