HBC15885Fruits题解

不可一世的小女人 算法基础篇 42 0
想要成为编程高手?那就来试试全网最全C++题库,让您在练习中快速成长。
It’s universally acknowledged that there’re innumerable trees in the campus of HUST. In 8102, Alisa took fishing as her business. When she was walking along the bank and forgot the distance gradually, she came upon a peach forest and found an interesting thing. These trees lining up in one row can be numbered from 1 to N, and each one had a color. Alisa sometimes likes color X, and she will color the trees in [L,R] to the same color X, or sometimes wants to query the maximum elegant values of [L,R] after being cut into at most k+1 subintervals. The elegant value of an interval is defined as the sum of the number of different consecutive digits in each subinterval. For example: The elegant value of 2 2 2 3 3 is 2 and it becomes 4 after cutting twice.

It’s universally acknowledged that there’re innumerable trees in the campus of HUST. In 8102, Alisa took fishing as her business. When she was walking along the bank and forgot the distance gradually, she came upon a peach forest and found an interesting thing. These trees lining up in one row can be numbered from 1 to N, and each one had a color. Alisa sometimes likes color X, and she will color the trees in [L,R] to the same color X, or sometimes wants to query the maximum elegant values of [L,R] after being cut into at most k+1 subintervals. The elegant value of an interval is defined as the sum of the number of different consecutive digits in each subinterval. For example: The elegant value of 2 2 2 3 3 is 2 and it becomes 4 after cutting twice. (You can cut it into {2} {2} {2 3 3} or {2} {2 2 3} {3} or {2 2} {2 3} {3})

HBC15885Fruits题解
-第1张图片-东莞河马信息技术
(图片来源网络,侵删)

标签: HBC15885Fruits题解