#P1476G. Minimum Difference
Minimum Difference
No submission language available for this problem.
Description
You are given an integer array of size .
You have to perform queries. Each query has one of two types:
- " " — calculate the minimum value such that there are exist distinct integers such that (for every ) and (for every ), where is the number of occurrences of in the subarray . If it is impossible to choose integers, report it;
- " " — assign .
The first line contains two integers and () — the size of the array and the number of queries.
The second line contains integers ().
Next lines contain queries (one per line). Each query has one of two types:
- " " ()
- " " ().
It's guaranteed that there is at least one query of the first type.
For each query of the first type, print the minimum value of that satisfies all required conditions, or if it is impossible to choose distinct integers.
Input
The first line contains two integers and () — the size of the array and the number of queries.
The second line contains integers ().
Next lines contain queries (one per line). Each query has one of two types:
- " " ()
- " " ().
It's guaranteed that there is at least one query of the first type.
Output
For each query of the first type, print the minimum value of that satisfies all required conditions, or if it is impossible to choose distinct integers.