eolymp
bolt
Спробуйте наш новий інтерфейс для відправки розв'язків
Задачі

Unicycle counting

Unicycle counting

Going to circus college is not as fun as you were led to believe. You are juggling so many classes. Trapeze class is sometimes up, sometimes down. There’s a lot of tension in your high-wire class. And you’ve seen that lion taming can be cat-astrophic. The one pleasure you find is in riding unicycles with your fellow classmates. Many people have unicycles with different sized wheels. One day you notice that all their tires leave a small mark on the ground, once per rotation. You decide to amuse yourself and avoid your classwork by trying to determine how many unicycles have passed by on a given stretch of road. In fact, you want to know the minimum number of unique unicycles that could have left the marks you observe. You make the simplifying assumption that any unicycle riding on the road will ride completely from the beginning to the end. The figures below illustrate the sample input. Each thick black vertical stripe represents a mark left by a tire. \includegraphics{https://static.e-olymp.com/content/cc/cc5e2c459427baea9823a29c04fb0f4d3ee854da.jpg} \InputFile Each line of input represents the observations on a stretch of road. A line begins with two integers \textbf{1} ≤ \textbf{m} ≤ \textbf{100} and \textbf{1} ≤ \textbf{n} ≤ \textbf{10}, where \textbf{m} represents the length of the road and \textbf{n} represents the number of marks you observe on the road. These are followed by \textbf{n} unique integers \textbf{a_1}, \textbf{a_2}, ..., \textbf{a_n}, where \textbf{0} ≤ \textbf{a_i} < \textbf{m} for all \textbf{a_i}. These \textbf{n} integers represent the positions where you observed a unicycle’s tire has left a mark. There will be at most \textbf{100} lines of input. Input ends at end of file. \OutputFile For each set of observations, print the minimum number of unicycles that could have produced the observed marks.
Ліміт часу 10 секунд
Ліміт використання пам'яті 256 MiB
Вхідні дані #1
10 5 1 3 5 7 9
10 4 1 3 7 9
20 10 0 4 5 7 8 10 12 14 15 16
Вихідні дані #1
1
2
3
Джерело 2012 ACM-ICPC North American Qualification Contest