1. i 是a[1..i]最小点,可以单独一个数 a[i] 作子序列,不需要倒数第二个数,此时f[i]+=1 2.假设 j 是左边距离 i 最近的满足a[j]
I made a video editorial discussingEdu 160D — Array Collapse. The video talks about how to use monotonic stacks to perform DP transitions faster. Youtube Link I also created some basic problems to help you practice the stuff covered in the video. You can access the group using this linkht...
Educational Codeforces Round 160 (Rated for Div. 2) D. Array Collapse 单调栈+线性dp+前缀和优化 性质发现:对于进行若干次操作后剩下的数字组成的新序列,将这些数字称为保留数。从原数组角度去看,被删掉的数肯定是被左右保留数之一删掉的。那么可以定量得出每个数作为保留数的作用范围(选中包含这个数的一段区...
D. Array Collapse You are given an array[p1,p2,…,pn][p1,p2,…,pn], where all elements are distinct. You can perform several (possibly zero) operations with it. In one operation, you can choose acontiguous subsegmentofppand removeallelements from that subsegment,except forthe minimum ele...
Edu 160 D. Array Collapse 三巷 来自专栏 · Codeforces题解 1 人赞同了该文章 题意: 给你一个数组[ 1, 2,…, ] ,其中所有元素都是不同的。 你可以对它执行几个(可能是零)操作。在一个操作中,你可以从 p 中选择一个连续的子段,然后从该子段中删除所有元素,除该子段中最小的元素。例如,如果选...