제출 #861841

#제출 시각아이디문제언어결과실행 시간메모리
861841maks007Zalmoxis (BOI18_zalmoxis)C++14
0 / 100
1086 ms10548 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...