[Solution] Monoblock Codeforces Solution| Solution Codeforces
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
- is ;
- is , as it could be split into blocks and ;
- is 3, as it could be split into blocks , , and .
You are given an array of length . There are queries of two integers , . A query , means that from now on the -th element of the array is equal to .
In the first line you are given with two integers and ().
The second line contains integers () — the array .
In the next lines you are given the descriptions of queries. Each line contains two integers and (, ).
Print the answer to each query on a new line.
No comments:
Post a Comment