| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1298797 | islam_2010 | Karte (COCI18_karte) | C++20 | 0 ms | 0 KiB |
#include <bits/stdc++.h>
using namespace std;
signed main(){
int n, k;
cin >> n >> k;
int a[n];
for(int i = 0; i < n; i++){
cin >> a[i];
}sort(a, a+n);
sort(a+n-k, a+n);
for(int i = 0; i < n-k; i++){
if(a[i] > k){
cout << -1;
return;
}
}for(int i = n-k; i < n; i++){
if(a[i] <= n - i - 1){
cout << -1;
return;
}
}for(int i = 0; i < n; i++){
cout << a[i] << " ";
}
}
