codeforces 1567 E. Non-Decreasing Dilemma

本文介绍了Codeforces Round #742(Div. 2)比赛中的E题——Non-Decreasing Dilemma。文章详细阐述了题目要求,即在序列上进行修改和询问非递减子序列数量的操作,以及如何利用线段树解决此问题。文章包含了输入输出示例、解题思路和注意事项。
摘要由CSDN通过智能技术生成

本场比赛其他题目的题解

A. Domino Disaster
B. MEXor Mixup
C. Carrying Conundrum
D. Expression Evaluation Error
E. Non-Decreasing Dilemma

E. Non-Decreasing Dilemma

开启传送门

题目描述

Alice has recently received an array a 1 , a 2 , … , a n a_1, a_2, \dots, a_n a1,a2,,an for her birthday! She is very proud of her array, and when she showed her friend Bob the array, he was very happy with her present too!

However, soon Bob became curious, and as any sane friend would do, asked Alice to perform q q q operations of two types on her array:

  • 1   x   y 1\ x\ y 1 x y: update the element a x a_x ax to y y y (set a x = y a_x=y ax=y).
  • 2   l   r 2\ l\ r 2 l r: calculate how many non-decreasing subarrays exist within the subarray [ a l , a l + 1 , … , a r ] [a_l, a_{l+1}, \dots, a_r] [al,al+1,,ar]. More formally, count the number of pairs of integers ( p , q ) (p,q) (p,q) such that l ≤ p ≤ q ≤ r l\le p\le q\le r lpqr and a p ≤ a p + 1 ≤ d o t s ≤ q q − 1 ≤ a q a_p\le a_{p+1}\le dots\le q_{q-1}\le a_q apa
  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

zuhiul

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值