Problem B
Keyboards in Concert
Olav has some electronic keyboards and would like to play a tune. Unfortunately all of Olav’s keyboards are broken so each of them can only play some of the notes. By switching which instrument he is using he will be able to play the whole tune, but moving keyboards around is annoying so he would like to minimize the amount of times he has to switch. Can you help Olav figure out the minimum number of keyboard switches needed to play the entire song?
Input
The first line of input is two space separated integers;
Output
The minimum number of times Olav needs to switch the instrument he is using during the tune.
Sample Input 1 | Sample Output 1 |
---|---|
2 10 2 1 2 2 2 3 1 2 1 2 3 3 2 3 1 3 |
3 |