luogu#P4690. [Ynoi Easy Round 2016] 镜中的昆虫

    ID: 3679 远端评测题 1500ms 64MiB 尝试: 0 已通过: 0 难度: 8 上传者: 标签>2016树状数组颜色段均摊(珂朵莉树 ODT)cdq 分治O2优化Ynoi

[Ynoi Easy Round 2016] 镜中的昆虫

Background

Are there beautiful things in the world inside a mirror?

Are there happy things in the world inside a mirror?

Me in the mirror world, wearing the same bored expression as I do.

— From Alice in the Mirror Country

A battle story of two girls.

Literature represents a strong will, and chemistry is the power to resist the physical world.

These are the only two weapons they have to fight reality.

Ah, Leblanc!

Today I am going to climb onto the milky-white moon!

There is no need to invent a machine. Indeed, I will leap out in one jump!

That’s right, my friend! The world of that moon!

That is the world created for us!

More than one person I love was probably exiled there... and is waiting for me...

Socrates! Galileo!

The soul of the basic elements of matter is...

This is... no, something is wrong... Copernicus said it before!

That’s right, my friends. Why on earth have I been bewitched?

Why on earth have I been bewitched? What on earth is he doing on a two-masted warship?

As a philosopher!

A physicist!

A poet!

A swordsman!

A musician!

An aerial traveler!

A debater who argues needle to needle!

He can do anything.

As the supreme... but...

yet he achieves nothing...

...Yes, you guys want to take everything from me!

...Come on, take it, just take it...

But... no matter how you shout, on the road to the new world, I will still take one thing with me!

Let me see your strong heart!

That’s right, the plume on your hat!

The emblem of courage in your heart... the plume on your hat!

Sorry, I have to go. I can’t keep people waiting!

Look... the moon has come to greet me!

Mon panache!

I step into the air.

The two of them desperately try to pull me back.

But I step into the air.

That’s right.

For a brand-new world, I will fall from the sky.

To gain new power.

For a new truth.

I take this step.

From my hands, I feel the trembling of the two of them.

It’s okay...

I am by your side!

Sora!

I throw myself completely into the air.

My body instantly falls from the air toward the ground.

I tightly grip their wrists and pull them along.

Seeing their expressions...

They cry and laugh at the same time...

They seem very scared...

yet also seem very happy...

Ah...

What is this? Flying feels so comfortable.

As if I have become an angel...

Such fast speed...

Such fast wind...

But I can’t hear any sound...

The world is turning quietly.

Soon, we are about to reach the ground...

The pioneer of aerodynamics...

I know that everything is turning in the sky,

and the earth that embraces me.

Just a little more, and I will reach the world...

Just a little more, and I will reach the ground...

The approaching shadow.

The ground reflects my silhouette.

Problem Description

You are enjoying HS in a galgame, but the game crashes, so you can only do a data structure problem:

Maintain a sequence aia_i of length nn, with mm operations.

  1. Modify the values in interval [l,r][l,r] to xx.

  2. Query how many different numbers appear in interval [l,r][l,r]. That is, if the same number appears multiple times, it is counted only once.

Input Format

The first line contains two integers n,mn,m.

The second line contains nn integers representing aia_i.

The next mm lines are either 1 l r x1\ l\ r\ x or 2 l r2\ l\ r, representing modification and query respectively.

Output Format

For each query, output one number as the answer.

5 5
1 2 3 4 5
2 1 5
1 2 3 4
2 1 5
2 3 3
2 2 4
5
3
1
1

Hint

Idea: nzhtl1477, Solution: nzhtl1477, Code: nzhtl1477, Data: nzhtl1477

Constraints: 1n,m1051\leq n , m \leq 10^51ai1091\leq a_i\leq 10^9

Translated by ChatGPT 5