# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
104682 |
2019-04-08T19:43:12 Z |
IVIosab |
Karte (COCI18_karte) |
C++17 |
|
124 ms |
11704 KB |
#include <bits/stdc++.h>
using namespace std;
#define f first
#define s second
#define mp make_pair
#define ll long long
int main() {
//freopen("input.txt", "r", stdin);
//freopen("output.txt", "w", stdout);
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int n,k;
cin>>n>>k;
int ar[n];
for(int i=0;i<n;i++){
cin>>ar[i];
}
sort(ar,ar+n);
vector<int> v;
for(int i=0;i<n-k;i++){
v.push_back(ar[i]);
}
for(int i=n-1;i>=k-1;i--){
v.push_back(ar[i]);
}
int fss=0,z=0;
for(int i=n-1;i>=0;i--){
if(fss<v[i]){
fss++;
z++;
}
}
if(z!=k){
cout<<-1<<endl;
}
else{
for(int i=0;i<n;i++){
cout<<v[i]<<" ";
}
cout<<endl;
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
384 KB |
Output is correct |
2 |
Correct |
2 ms |
384 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
384 KB |
Output is correct |
2 |
Correct |
2 ms |
384 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
384 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
384 KB |
Output is correct |
2 |
Correct |
3 ms |
384 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
384 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
384 KB |
Output is correct |
2 |
Correct |
2 ms |
304 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
384 KB |
Output is correct |
2 |
Correct |
3 ms |
384 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
27 ms |
2556 KB |
Output is correct |
2 |
Correct |
19 ms |
2556 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
49 ms |
4816 KB |
Output is correct |
2 |
Correct |
36 ms |
4592 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
124 ms |
11704 KB |
Output is correct |
2 |
Correct |
100 ms |
9580 KB |
Output is correct |