This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "bits/stdc++.h"
using namespace std;
signed main () {
ios::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
int n, k;
cin >> n >> k;
vector <int> a, b;
for(int i = 0; i < n; i ++) {
int x;
cin >> x;
a.push_back(x);
}
b = a;
sort(a.rbegin(), a.rend());
int which = -1;
while(a.size() != 1) {
int val1 = a.back();
a.pop_back();
if(val1 == a.back()) {
a.pop_back();
a.push_back(val1+1);
}else {
k --;
which = val1;
a.push_back(val1+1);
}
}
assert(which != -1);
for(auto i : b) cout << i << " ";
cout << which;
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |