# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
580243 |
2022-06-20T19:34:11 Z |
MrM7md |
Karte (COCI18_karte) |
C++17 |
|
108 ms |
7112 KB |
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define endl "\n"
const int MOD = 1e9 + 7;
int frq[1000050];
signed main(){
ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int n,k;
cin >> n >> k;
vector<int> v(n);
for(int i=0;i<n;i++)cin >> v[i];
sort(v.begin(),v.end(),greater<int>());
sort(v.begin(),v.begin()+k);
int cnt=0;
for(int i=0;i<n;i++){
if(v[i]>cnt){
cnt++;
}
}
if(cnt==k){
for(int i=0;i<n;i++){
cout<<v[i]<<' ';
}
}
else{
cout<<-1;
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
340 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
340 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
340 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
27 ms |
1656 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
46 ms |
2920 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
108 ms |
7112 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |