## GUPTA MECHANICAL

IN THIS WEBSITE I CAN TELL ALL ABOUT TECH. TIPS AND TRICKS APP REVIEWS AND UNBOXINGS ALSO TECH. NEWS .............

# [Solution] Monoblock Codeforces Solution| Solution Codeforces

C. Monoblock
time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output

Stanley has decided to buy a new desktop PC made by the company "Monoblock", and to solve captcha on their website, he needs to solve the following task.

The awesomeness of an array is the minimum number of blocks of consecutive identical numbers in which the array could be split. For example, the awesomeness of an array

• $\left[1,1,1\right]$ is $1$;
• $\left[5,7\right]$ is $2$, as it could be split into blocks $\left[5\right]$ and $\left[7\right]$;
• $\left[1,7,7,7,7,7,7,7,9,9,9,9,9,9,9,9,9\right]$ is 3, as it could be split into blocks $\left[1\right]$$\left[7,7,7,7,7,7,7\right]$, and $\left[9,9,9,9,9,9,9,9,9\right]$.

You are given an array $a$ of length $n$. There are $m$ queries of two integers $i$$x$. A query $i$$x$ means that from now on the $i$-th element of the array $a$ is equal to $x$.

Solution Click Below:-  👉
👇👇👇👇👇

Input

In the first line you are given with two integers $n$ and $m$ ($1\le n,m\le {10}^{5}$).

The second line contains $n$ integers ${a}_{1},{a}_{2},\dots ,{a}_{n}$ ($1\le {a}_{i}\le {10}^{9}$) — the array $a$.

In the next $m$ lines you are given the descriptions of queries. Each line contains two integers $i$ and $x$ ($1\le i\le n$$1\le x\le {10}^{9}$).

Output

Print the answer to each query on a new line.