当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

6019:MG loves gold

题目描述
MG is a lucky boy. He is always be able to find gold from underground.

It is known that the gold is a sequence with $n$ elements, which has its own color $C$.

MG can dig out a continuous area of sequence every time by using one shovel, but he's unwilling to dig the golds of the same color with one shovel.

As a greedy person, he wish to take all the n golds away with least shovel.
The rules also require MG not to dig twice at the same position.

MG thought it very easy and he had himself disdained to take the job. As a bystander, could you please help settle the problem and calculate the answer?
输入解释
The first line is an integer $T$ which indicates the case number.($1<=T<=10$)

And as for each case, there are $1$ integer $n$ in the first line which indicate gold-number($1<=n<=100000$).

Then there are $n$ integers $C$ in the next line, the x-th integer means the x-th gold’s color($|C|<=2000000000$).
输出解释
As for each case, you need to output a single line.

there should be one integer in the line which represents the least possible number of shovels after taking away all $n$ golds.
输入样例
2
5
1 1 2 3 -1
5
1 1 2 2 3
输出样例
2
3
来自杭电HDUOJ的附加信息
Recommend wange2014

该题目是Virtual Judge题目,来自 杭电HDUOJ

题目来源 BestCoder Round #93

源链接: HDU-6019

最后修改于 2020-10-25T23:27:37+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
3000/1500MS(Java/Others) 262144/262144K(Java/Others)