Brewing potion 6 - MarisaOJ: Marisa Online Judge

Brewing potion 6

Time limit: 1000 ms
Memory limit: 256 MB
Marisa has $n$ empty bottles arranged in a row. She will fill them up with several type of mushrooms. She will perform $q$ operations. Each operation, she will either: - Add a mushroom of type $x$ to each bottle in range $[l, r]$. - Determine if all bottles in range $[l, r]$ have the same ingredients. Help her answer the second operation! ### Input - The first line contains two integers $n, q$. - The next $q$ lines, each is a query of either form: + `1 l r x`: the first operation. + `2 l r`: the second operation. ### Output - For each operation of type $2$, print `YES` if all bottles have the same ingredients, otherwise print `NO`. ### Constraints - $1 \le n, q \le 10^5$. - $1 \le l \le r \le n$. - $1 \le x \le 10^5$. ### Example Input: ``` 4 7 2 1 3 1 1 3 5 1 3 4 6 2 1 3 2 1 2 1 2 2 5 2 1 2 ``` Output: ``` YES NO YES NO ```