【无标题】

Sequence

 1000ms  31072K

描述:

Given an array aa consisting of nn integers, on which you are to perform mm operations of two types.

  1. Given two integers x,yx,y, replace the number of index xx with number yy. That is ax:=yax:=y.

  2. Given one integer xx, print the number of consecutive subsequences of aa, whose minimum value equals to axax.

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.

1月17:

Sequence

描述:

给一个由n个整数组成的系列,在这里面你需要执行两种操作。

  1. 给出两个整数x,y。将指数x的数量替换为数字y,那就是ax:=y。
  2. 给出一个整数x,输出a的子序列的数量,其中最小的数就等于ax.

这是确保在任何时候都没有重复值。

输入:

第一行包括两个整数n,m(1<=n,m<=10^5),其中n是数组的大小,m是要执行的操作数

第二行包括n个整数,第i个整数就是ai(1<=ai<=2^31-1)

然后,接下来的m行,按顺序描述要执行的m个操作。

每一行一整数opt(1,2)开始,意味着要执行的操作数。

如果opt等于1,两个整数x,y(1<=x<=n,1<=y<=2^31-1)如下所述

如果opt等于2,一个数x(1<=x<=n)如下所述

输出:

对于类型2的每个操作,在每一行上打印一个整作为答案。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值