Rosetta Problems

単調増加にする最小コスト

長さ NN の数列 AA を単調増加な整数列 BB に変えるとき、∑∣Ai−Bi∣\sum |A_i - B_i| の最小値を求める。

関連リンク