You are given an array a, consisting of n integers. We defifine an operation as follows: Select k integers in the array a, remove them and append the sum of them at the end of the array. An array A is lexicographically larger than an array B if in the fifirst position where A and B differ, A has a number greater than the corresponding number in B. For example, [0, 1, 14, 0] is lexicographically larger than [0, 1, 5, 6], because the fifirst position they differ in is at the third number, and 14 is greater than 5. Lexicographically largest array means the array is lexicographically larger than any other arrays of the same length. Please print the lexicographically largest array after performing given operations p times.
You are given an array a, consisting of n integers. We defifine an operation as follows: Select k integers in the array a, remove them and append the sum of them at the end of the array. An array A is lexicographically larger than an array B (of the same length) if in the fifirst position where A and B differ, A has a number greater than the corresponding number in B. For example, [0, 1, 14, 0] is lexicographically larger than [0, 1, 5, 6], because the fifirst position they differ in is at the third number, and 14 is greater than 5. Lexicographically largest array means the array is lexicographically larger than any other arrays of the same length. Please print the lexicographically largest array after performing given operations p times.