单调队列应用介绍

时间:2024-10-01 17:45:14
适用于最优化DP(动态规划)算法中动态规划转移,对应的动态转移方程类似 f ( i ) = max ⁡ l < = j < = r ( f ( j ) + b ( j ) + a ( i ) ) = max ⁡ l < = j < = r ( f ( j ) + b ( j ) ) + a ( i ) f(i) = \max_{l<=j<=r}(f(j) + b(j) + a(i)) = \max_{l<=j<=r}(f(j) + b(j)) + a(i) f(i)=l<=j<=rmax(f(j)+b(j)+a(i))=l<=j<=rmax(f(j)+b(j))+a(i),其中 max ⁡ l < = j < = r ( f ( j ) + b ( j ) ) \max_{l<=j<=r}(f(j) + b(j)) l<=j<=rmax(f(j)+b(j