Linas likes to play some musical instrument, and nobody knows what it is called. The instrument has S holes and Linas is able to play N different notes (numbered from 1 to N) by covering each hole in one of 10 different ways (numbered from 0 to 9). Every note can be played by covering all holes in exactly one way, described by a sequence of digits corresponding to coverings of respective holes. If the holes are covered incorrectly (i.e., not corresponding to any note), the instrument starts to produce very unpleasant sounds, so Linas plays a wrong note rather than covers holes incorrectly.
Linas plays in a band where he has to play complicated tunes very quickly. Linas has written a tune (i.e., a sequence of numbers, corresponding to notes) and he wants to play it together with the band. Unfortunately, Linas doesn’t play perfectly. He can only play two successive notes if by playing the second he has to cover no more than G holes differently than when playing the first one. Hence he decided to sometimes play a wrong note in the tune. Each incorrect note Linas plays is called mistake.
입력 5 4 2 1111 2101 2000 0100 0000 7 1 5 4 5 3 2 1 출력 1 1 2 4 5 3 2 1 Linas can’t play note 5 directly after note 1.
출처:BOI 2012 day2 2/3