英文原题:题目来源:https://acs.jxnu.edu.cn/problem/ICPCJX2020H
Sequence
1000ms 31072K
描述:
Given an array a consisting of nn integers, on which you are to perform mm operations of two types.
-
Given two integers x,y replace the number of index x with number y. That is ax:=y.
-
Given one integer x, print the number of consecutive subsequences of a, whose minimum value equals to ax.
It's guaranteed that there are no duplicated value in array aa at any moment.
输入:
The first line contains two intergers n,m(1≤n,m≤105)n,m(1≤n,m≤105), where nn is the size of the array and mm is the number of operations to perform.
The second line contains nn integer, the ithith integer is ai(1≤ai≤231−1)ai(1≤ai≤231−1).
Then, mm lines follow, describing mm operation you are to perform in order.
Each line start with an integer opt∈[1,2]opt∈[1,2], meaning the type of operation to perform.
If opt=1opt=1, two integers x,y(1≤x≤n,1≤y≤231−1)x,y(1≤x≤n,1≤y≤231−1) follows, mentioned above.
If opt=2opt=2, one integer x(1≤x≤n)x(1≤x≤n) follows, mentioned above.
输出:
For each operation of type 22, print one integer on one line as the answer.
序列
描述:
给定一个由n个整数组成的数组a,在该数组上执行两种类型的m运算。
1.给定两个整数x,y用数字y替换索引x的数字。也就是ax:=y。
2.给定一个整数x,打印a的连续子序列数,其最小值等于ax。
保证数组a中任何时刻都没有重复的数值。
输入:
译
第一行包含两个整数n,m(1≤n、 m≤105),其中n是数组的大小,m是要执行的操作数。
第二行包含n整数,第i个整数是ai(1≤ai≤231−1).
接下来后面是m行,按顺序执行的m操作。
每行开头是整数opt∈[1,2],表示要执行的操作类型。
如果opt=1,两个整数 x,y(1≤x≤n,1≤y≤231−1)接下来同上。
如果opt=2,则为一个整数x(1≤x≤n)接下来同上。
输出:
每行对于每个类型2的每个操作,打印一个整数作为答案。