# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
168320 | aydinenes | Karte (COCI18_karte) | C++11 | 343 ms | 9988 KiB |
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>
#define mid(l,r) ((l+r)/2)
using namespace std;
const int N = 1e6 + 7;
const int inf = 1e9 + 7;
int n, k;
vector<int> v;
vector<int> ans;
int main(){
cin >> n >> k;
for(int i = 0; i < n; i++){
int t;
cin >> t;
v.push_back(t);
}
sort(v.begin(), v.end());
for(int i = n - k; i < n; i++){
if(v[i] <= ans.size()){
cout << "-1";
return 0;
}
ans.push_back(v[i]);
}
for(int i = 0; i < n - k; i++){
if(v[i] > k){
cout << "-1";
return 0;
}
ans.push_back(v[i]);
}
for(int i = ans.size() - 1; i >= 0; i--){
cout << ans[i] << " ";
}
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |