# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
580199 |
2022-06-20T17:26:11 Z |
MrM7md |
Karte (COCI18_karte) |
C++17 |
|
101 ms |
6780 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);
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 |
0 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 |
0 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 |
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 |
24 ms |
1580 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
44 ms |
2892 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
101 ms |
6780 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |