luogu#P5066. [Ynoi Easy Round 2014] 人人本着正义之名
[Ynoi Easy Round 2014] 人人本着正义之名
Background
What is that?
【Not the Sixth Beast, but a new beast?】
【I have never seen that thing before.】

【All personnel retreat.】
【An unexpected beast has been confirmed.】
【Based on this situation, confirm the operation as a failure and abandon Island No. 15.】
How could this be...

I made a promise with him.
We must come back alive, no matter what.

I will tell him, “I’m back,” and then taste the butter cake.
So if the world ends, I will be in big trouble.

A forest melting into the morning mist.
Ah...?

【Milk traces, dazzling petals, a whirlwind air mass.】
【A herring hung on the wall, an upside-down hedgehog, an organ in a bag.】
What is this...?

Actually... you really want to fight, right?
Although I do not know what you are planning, it is enough already.

You do not need to fight anymore.
Because your fight has already been inherited by me, by us.
【Actually, I am very grateful to you.】
【All this time, all I could think about was dying.】

【Longing to go back to those guys waiting for me, that was my only wish.】
【But after meeting you, I changed a little.】
【I started longing for a place to belong again.】
【After meeting you, I found some salvation.】
【Being able to wait until you return safely, right now I...】
【Well, you could say I feel a bit of happiness.】
Ah...?

【N-no... wait, do not distance yourself from me so directly.】
【And do not make that face like “what is this shameless creature doing.”】
【But then again, you observed me very carefully.】
Haha...
Because I fell for you~


【I cannot help it.】
If you go, I will be angry, I will rage.
【Chtholly...】

【Sorry.】

I will wait for you.

I will wait for you, so you must come back.

【I promise, I will definitely come back.】
Mm.
It is a promise~

Problem Description
You need to help Chtholly maintain a 01 sequence of length . There are operations:
1 l r: Set all numbers in interval to .2 l r: Set all numbers in interval to .3 l r: For all in , change it to the bitwise OR of and . These changes are performed simultaneously.4 l r: For all in , change it to the bitwise OR of and . These changes are performed simultaneously.5 l r: For all in , change it to the bitwise AND of and . These changes are performed simultaneously.6 l r: For all in , change it to the bitwise AND of and . These changes are performed simultaneously.7 l r: Query the sum over interval .
This problem is forced online. Each needs to be XORed with the previous answer using . If there has been no query before, then the previous answer is .
Input Format
The first line contains two integers and .
The second line contains integers representing the sequence .
Then follow lines, each containing three integers , indicating which operation it is and the interval it applies to.
Output Format
For each query operation, output one line with one number as the answer.
5 5
0 1 0 0 1
3 2 5
5 2 5
2 2 2
6 1 5
7 1 5
1
Hint
Idea: nzhtl1477, Solution: nzhtl1477, Code: nzhtl1477, Data: nzhtl1477.
The sequence after each step:
For of the testdata, .
For of the testdata, .
For another of the testdata, both the operations and the sequence are generated randomly.
For another of the testdata, .
Constraints: for of the testdata, , .
Translated by ChatGPT 5