Zuma
의견: 0
One day Mirko, while he was walking through the high grass, stumbled upon a sequence of \(N\) colored marbles. Soon he noticed that if he touches \(K\) or more consecutive marbles of the same color, they start to twinkle and then he could wish them to magically vanish, although he doesn't have to do that immediately (see \(3\)rd 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.
The first line of input contains two integers \(N\) (\(1 \le N \le 100\)) and \(K\) (\(2 \le K \le 5\)) — the number of marbles in the initial sequence and the minimal number of consecutive marbles of the same color he could wish to vanish.
The next line contains exactly \(N\) integers between \(1\) and \(100\) (inclusive), separated by one space. Those numbers represent colors of marbles in the sequence Mirko found.
The output should contain only one line with a single integer numb\(er - th\)e
minimal number of marbles Mirko has to insert to achive the desired effect.
SAMPLE TEST CASES
Input:
2 5
1 1
Input:
5 3
2 2 3 2 2
Input:
10 4
3 3 3 3 2 3 1 1 1 3
Output:
3
Output:
2
Output:
4
| 서브태스크 | 점수 | 설명 |
|---|---|---|
Test 1 | 10점 | None |
Test 2 | 10점 | None |
Test 3 | 10점 | None |
Test 4 | 10점 | None |
Test 5 | 10점 | None |
Test 6 | 10점 | None |
Test 7 | 10점 | None |
Test 8 | 10점 | None |
Test 9 | 10점 | None |
Test 10 | 10점 | None |
2 5
1 135 3
2 2 3 2 2210 4
3 3 3 3 2 3 1 1 1 34평가 및 의견
Zuma
Log in to rate problems.
아직 의견이 없습니다. 자격이 된다면 위 양식에서 가장 먼저 평가해 보세요.
풀이 제출
Zuma