Pair - MarisaOJ: Marisa Online Judge

Pair

Time limit: 4000 ms
Memory limit: 256 MB
Given an array A of n integers and q queries of either forms: - 1lrx: increase each element Al,Al+1,...,Ar by x. - 2x: find the maximum j−i that Ai=Aj=x. ### Input - The first line contains two integers n,q. - The second line contains n integers Ai. - The next q lines, each line contains a query of the above forms. ### Output - Print an integer, which is the answer for each query of type 2. If there is no answer, print -1. ### Constraints - 1≤n,q≤105. - 1≤l,r≤n. - 1≤Ai,x≤2×109. ### Example Input: 231212212324 Output: 0-1