[문제요약] One day Mirko, while he was walking through the high grass, 하루 미코는 풀 숲을 지나다가 N 개의 돌에 넘어졌다. stumbled upon a sequence of N colored marbles. Soon he noticed that if he touches K or more consecutive marbles of the same color, 곧 그는 알아 챘다. K 개의 이상의 연속한 돌을 건드리면 they start to twinkle and then he could wish them to magically vanish, although he doesn't have to do that immediately (see 3. sample).
Fortunately, Mirko brought an inexhaustible supply of marbles from home, so he can insert a marble of any color anywhere in the array (at the beginning, between any two existing marbles, or at the end).
Help Mirko find the smallest number of marbles he must insert into the sequence before he could make all of the marbles vanish.
Fortunately, Mirko brought an inexhaustible supply of marbles from home, so he can insert a marble of any color anywhere in the array (at the beginning, between any two existing marbles, or at the end).
Help Mirko find the smallest number of marbles he must insert into the sequence before he could make all of the marbles vanish.
입력 2 5 1 1 출력 3 입력 5 3 2 2 3 2 2 출력 2 입력 10 4 3 3 3 3 2 3 1 1 1 3 출력 4
출처:coci 2009-2010 contest5