#P4683. GukiZ and GukiZiana
GukiZ and GukiZiana
GukiZ and GukiZiana
题面翻译
给定一个数列,有两个操作:
- 给定,令都加上。
- 给定,求一个最大的,满足,输出最大的,无解输出。
题目描述
Professor GukiZ was playing with arrays again and accidentally discovered new function, which he called . For given array , indexed with integers from to , and number , represents maximum value of , such that . If there is no as an element in , then is equal to . GukiZ also prepared a problem for you. This time, you have two types of queries:
- First type has form and asks you to increase values of all such that by the non-negative integer .
- Second type has form and asks you to find value of .
For each query of type , print the answer and make GukiZ happy!
输入格式
The first line contains two integers , ( ), size of array , and the number of queries.
The second line contains integers ( ), forming an array .
Each of next lines contain either four or two numbers, as described in statement:
If line starts with , then the query looks like ( , ), first type query.
If line starts with , then th query looks like ( ), second type query.
输出格式
For each query of type , print the value of , for value for that query.
样例 #1
样例输入 #1
4 3
1 2 3 4
1 1 2 1
1 1 1 1
2 3
样例输出 #1
2
样例 #2
样例输入 #2
2 3
1 2
1 2 2 1
2 3
2 4
样例输出 #2
0
-1