# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
580247 |
2022-06-20T19:37:47 Z |
MrM7md |
Karte (COCI18_karte) |
C++17 |
|
104 ms |
6840 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=n-1;i>=0;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 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
# |
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 |
Correct |
1 ms |
340 KB |
Output is correct |
2 |
Correct |
1 ms |
340 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
340 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
340 KB |
Output is correct |
2 |
Correct |
1 ms |
340 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
340 KB |
Output is correct |
2 |
Correct |
1 ms |
340 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
23 ms |
1624 KB |
Output is correct |
2 |
Correct |
15 ms |
1620 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
43 ms |
2984 KB |
Output is correct |
2 |
Correct |
30 ms |
3040 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
104 ms |
6840 KB |
Output is correct |
2 |
Correct |
72 ms |
5264 KB |
Output is correct |