#SGM0000076. Truy vấn giá trị phân biệt II (Distinct Values Queries II)
Truy vấn giá trị phân biệt II (Distinct Values Queries II)
Distinct Values Queries II
Source: CSES
Version: Phuoc Hung OJ Extended
Problem
Process point updates 1 k u and queries 2 a b asking whether all values in subarray are pairwise distinct.
Input
The first line contains , then the initial array, followed by operations.
Output
For every type-2 query print YES if all values are distinct, otherwise NO.
Subtasks
Subtask 1 (20%)
- , number of queries .
- All other conditions are the same as Subtask 3.
Subtask 2 (30%)
- , number of queries .
- All other conditions are the same as Subtask 3.
Subtask 3 (50%)
Example
Input
5 4
3 2 7 2 8
2 3 5
2 2 5
1 2 9
2 2 5
Output
YES
NO
YES
Explanation
Initially [2,5] contains [2,7,2,8], so it is not distinct. After changing position 2 to 9, the same range becomes [9,7,2,8].