Initially, you have an array of one number - a1. The next operation is performed on this array k times. The elements of the array are taken and for each subsequent number the number of times it occurs and the number itself are written down. Then the same operation is performed on the resulting array. For example, look at k=4, a1=3. Initially, the array contains only one number 3. The new resulting array is:[1,3]. The process is repeated a second time. The resulting array will be:[1,1,1,3]. Next it will be [3,1,1,3]. Finally, the array becomes [1,3,2,1,1,3]. Your task is to know a1and k, print the final resulting array.
In the first line 2 natural numbers, a1,k(1≤a1,k≤50).
Print the resulting array.
3 4
1 3 2 1 1 3
Login to be able to submit.
Problem | ||
---|---|---|
A1 | Body Mass Index #1 | 63 |
A2 | Body Mass Index #2 | 61 |
B | Decision tree | 56 |
C | Outputting numbers in waves | 31 |
D | Filling an array | 39 |
E | Fix it | 26 |
F | Atlas of Khorezmstan | 6 |
G | Covering | 10 |
H | Number prefixes and suffixes | 2 |
I | Prefixes on segments | 2 |
J | Meta-problem | 5 |
Language | Specific limits |
---|---|
Python 3.12 | 4.0 s / - MB |
Java 19 | 4.0 s / - MB |