英语题目作业(8)

原题:

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.

(链接:https://acs.jxnu.edu.cn/problem/ICPCJX2020H)

翻译:

序列

有一个数组a,由n个整数组成,对其你可进行m次以下两种类型的操作:

1.给出两个整数x,y,用y替代a中下标为x的数,即a[x]=y;

2.给出一个整数x,表示需要输出的a的连续子串的长度,并它的最小值等于a[x].

任何时候数组a都没有重复的值。

输入:

第一行包括两个整数n,m(1<=n,m<=105),n是数组长度,m是操作次数。

第二行包括n个整数,第i个整数为a[i](1<=ai<=2^(31-1)).

接下来的m行描述你将按顺序进行的操作。

每行开头的一个整数为opt,取值为1或2,代表进行的操作类型。

如果opt=1,输入两个整数x,y(1<=x<=n,1<=y<=2^(31-1)),再按上述操作;

如果opt=2,输出一个整数x(1<=x<=n),再按上述操作。

输出:

对于每次的两种操作,一行输出一个整数代表答案。

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

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值