Dear MikeMirzayanov,
The Problem H of Codeforces Global Round 18 is a standard task of isotonic regression algorithm as well as this algoritem is well-known in China.
And my code is copied from this link:https://www.luogu.com.cn/blog/Hakurei-Reimu/solution-p6621. And I changed the cost value part and delete the liner-base part.
I think it is in line with the rules. It shouldn't be treated as cheating.
Regards, KAAM