Codeforces Global Round 23
F
Kazaee
Codeforces
2800
原题
← E2G →
翻译中…

You have an array $a$ consisting of $n$ positive integers and you have to handle $q$ queries of the following types:

翻译中…
  • $1$ $i$ $x$: change $a_{i}$ to $x$,
  • $2$ $l$ $r$ $k$: check if the number of occurrences of every positive integer in the subarray $a_{l}, a_{l+1}, \ldots a_{r}$ is a multiple of $k$ (check the example for better understanding).
翻译中…

Input

翻译中…

The first line of the input contains two integers $n$ and $q$ ($1 \le n , q \le 3 \cdot 10^5$), the length of $a$ and the number of queries.

翻译中…

Next line contains $n$ integers $a_{1}, a_{2}, \ldots a_{n}$ ($1 \le a_{i} \le 10^9$) — the elements of $a$.

翻译中…

Each of the next $q$ lines describes a query. It has one of the following forms.

翻译中…
  • $1$ $i$ $x$, ($1 \le i \le n$ , $1 \le x \le 10^9$), or
  • $2$ $l$ $r$ $k$, ($1 \le l \le r \le n$ , $1 \le k \le n$).
翻译中…

Output

翻译中…

For each query of the second type, if answer of the query is yes, print "YES", otherwise print "NO".

翻译中…

Note

翻译中…

In the first query, requested subarray is $[1234, 2, 3, 3, 2, 1]$, and it's obvious that the number of occurrence of $1$ isn't divisible by $k = 2$. So the answer is "NO".

翻译中…

In the third query, requested subarray is $[1, 2, 3, 3, 2, 1]$, and it can be seen that the number of occurrence of every integer in this sub array is divisible by $k = 2$. So the answer is "YES".

翻译中…

In the sixth query, requested subarray is $[1, 2, 3, 3, 2, 1, 1, 2, 3]$, and it can be seen that the number of occurrence of every integer in this sub array is divisible by $k = 3$. So the answer is "YES".

翻译中…

样例

Input #1
10 8
1234 2 3 3 2 1 1 2 3 4
2 1 6 2
1 1 1
2 1 6 2
2 1 9 2
1 10 5
2 1 9 3
1 3 5
2 3 10 2
Output #1
NO
YES
NO
YES
YES
InputCopy OutputCopy
题目信息
题号
1746F
时间限制
3 s
内存限制
256 MB
标签
数据结构
哈希
概率论

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。