luogu#P4117. [Ynoi2018] 五彩斑斓的世界
[Ynoi2018] 五彩斑斓的世界
Background
...Feathers.
Feathers falling from the sky.
Pure white, like snow,
swaying in the sea breeze,
dancing in the cool wind,
as if trying to carry away someone's heart—divine feathers.
...
"Please."
Who said that?
"Please."
"Save us."
...A dream.
I know this is a dream.
Then, that person spoke again, in my pure white dream:
"We will always be waiting here..."
So, I set off on a long journey.
There is a place I must go.
To fulfill that person's wish.
So I think, if...
if my wish could come true,
then maybe, you and I...

...The world has ended.
It has already ended.
I was too late—no matter what, everything...
...Hateful.
Unforgivable.
I...
...I will absolutely never forgive you.
Now, set out...
I will... I will definitely... take you...!

Hand... hand in hand, and hearts can be connected.
...My left hand is not holding anyone. It is my hand.

Grant the wish.
Only this fact will remain, and then the two of us will part.
It was in hope of this that the two of us walked together until today.
Is that so?

Come, let's set out, to choose that one-and-only tomorrow.

Problem Description
Erjiedang Zhenhong gives you a sequence of length , with operations.
- For every number greater than in the interval , subtract from it.
- Query the number of occurrences of in the interval .
Input Format
The first line contains two integers and .
The second line contains integers representing the sequence .
Then follow lines, each containing four integers:
1 l r x: For all numbers greater than in , subtract .2 l r x: Query the number of occurrences of in $[l,r]`.
Output Format
For each type-2 query, output one integer representing the answer.
5 6
1 5 5 5 8
2 2 5 5
1 2 4 3
2 2 5 2
2 2 5 5
1 3 5 1
2 1 5 1
3
3
0
3
Hint
Idea: nzhtl1477, Solution: nzhtl1477, Code: nzhtl1477, Data: nzhtl1477.
For of the testdata, , , , .
By nzhtl1477.
Translated by ChatGPT 5