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

    ID: 3640 远端评测题 1500ms 64MiB 尝试: 0 已通过: 0 难度: 8 上传者: 标签>2016树状数组递归O2优化分治Ynoi

[Ynoi Easy Round 2016] 镜中的昆虫

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