如题,代码和思维都难于本题的 CF1667B 都是绿的。
解法基本和 O(nlogn)\mathcal O(n \log n)O(nlogn) 求最长上升子序列一样吧。
然后建议把双倍经验 UVA12983 也降了捏。