# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
127394 |
2019-07-09T10:14:06 Z |
impri |
Karte (COCI18_karte) |
C++14 |
|
336 ms |
7868 KB |
#include<bits/stdc++.h>
using namespace std;
int main(void){
int n,k;
vector<int>a;
cin >> n >> k;
a.push_back(-1);
for(int i=1;i<=n;i++){
int c; cin >> c; a.push_back(c);
}
sort(a.begin(),a.end());
for(int i=1;i<=n-k;i++){
if(a[i]>k){
cout << -1;
return 0;
}
}
for(int i=1;i<=k;i++){
if(a[i+n-k]<i){
cout << -1;
return 0;
}
}
for(int i=n-k;i>=1;i--){
cout << a[i] << " ";
}
for(int i=k;i>=1;i--){
cout << a[i+n-k] << " ";
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
256 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
256 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
256 KB |
Output is correct |
2 |
Correct |
2 ms |
256 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
256 KB |
Output is correct |
2 |
Correct |
2 ms |
256 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
376 KB |
Output is correct |
2 |
Correct |
3 ms |
380 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
376 KB |
Output is correct |
2 |
Correct |
3 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
376 KB |
Output is correct |
2 |
Correct |
3 ms |
504 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
69 ms |
1876 KB |
Output is correct |
2 |
Correct |
59 ms |
1532 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
140 ms |
3436 KB |
Output is correct |
2 |
Correct |
117 ms |
2672 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
336 ms |
7868 KB |
Output is correct |
2 |
Correct |
295 ms |
5520 KB |
Output is correct |