# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
580196 |
2022-06-20T17:21:39 Z |
MrM7md |
Karte (COCI18_karte) |
C++17 |
|
113 ms |
6992 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;
int a[n];
for(int i=0;i<n;i++)cin>>a[i];
sort(a,a+n,greater<int>());
int f=0;
int id=0;
for(int i=n-1;i>=0;i--){
if(f<a[i]){
f++;
}
if(f==k)id=i;
}
if(f==k){
for(int i=0;i<n;i++){
cout<<a[i]<<' ';
}
}
else if(f<k){
cout<<-1;
}
else{
sort(a,a+id+1);
for(int i=0;i<n;i++){
cout<<a[i]<<' ';
}
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
3 |
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 |
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 |
32 ms |
1636 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
56 ms |
2940 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
113 ms |
6992 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |