[USACO 2013 Jan]Cow Lineup
题目描述
Description
Cow Lineup [Brian Dean and Daniel Dara, 2012] Farmer John’s N cows
(1 <= N <= 100,000) are lined up in a row. Each cow is identified
by an integer “breed ID” in the range 0…1,000,000,000; the breed
ID of the ith cow in the lineup is B(i). Multiple cows can share the
same breed ID. FJ thinks that his line of cows will look much more
impressive if there is a large contiguous block of cows that all have
the same breed ID. In order to create such a block, FJ chooses up to K
breed IDs and removes from his lineup all the cows having those IDs.
Please help FJ figure out the length of the largest consecutive block
of cows with the same breed ID that he can create by doing this.
有N头牛(1 <= N <= 100,000) 排成一列。每头牛有一个标号,范围在0到1000000000,
第 i 头牛的编号为B(i)。多头牛可以共享一个编号。John想,如果前后相邻的多头牛
能有相同的编号,将会更好。为了使前后相连且编号相同的牛的数量尽可能多,
John将选择 K 个编号,然后移除编号与