QOJ.ac

QOJ

時間限制: 1.5 s 記憶體限制: 64 MB 總分: 100

#9086. Insects in the Mirror

统计

Maintain a sequence $a_i$ of length $n$, with $m$ operations.

  1. Modify the values in the range $[l, r]$ to $x$.
  2. Query the number of distinct values in the range $[l, r]$, meaning that if the same number appears multiple times, it is counted only once.

Input

The first line contains two integers $n$ and $m$.

The second line contains $n$ integers representing $a_i$.

Each of the following $m$ lines is either $1\ l\ r\ x$ or $2\ l\ r$, representing a modification or a query, respectively.

Output

For each query, output a single number representing the answer.

Examples

Input 1

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

Output 1

5
3
1
1

Subtasks

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

$1\leq n, m \leq 10^5$, $1\leq a_i\leq 10^9$.

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.