Okay, this one was tough, segtree with dp? At least it's pretty similar to LIS with dp...
CSES-solutions
These are just my solutions to some cses.fi problems.
Description
Languages
C++
100%