# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
139398 |
2019-07-31T16:00:09 Z |
path |
Karte (COCI18_karte) |
C++14 |
|
43 ms |
4604 KB |
#include <bits/stdc++.h>
using namespace std;
#define f first
#define s second
#define PI acos(-1.0)
typedef unsigned long long int ll;
const int N=4e5+5;
int n,k,a[N],b[N],lst,tmp,tmp2;
vector <int> vec,t,l;
int main(){
cin.tie(NULL);
ios_base::sync_with_stdio(false);
cin>>n>>k;
for(int i=0;i<n;i++)
cin>>a[i];
sort(a,a+n);
for(int i=0;i<n-k;i++)
t.push_back(a[i]);
for(int i=n-1;i>=n-k;i--)
l.push_back(a[i]);
lst=0;
for(int i=n-k;i<n;i++,lst++)
b[lst]=a[i];
for(int i=0;i<n-k;i++,lst++)
b[lst]=a[i];
lst=0;
for(int i=n-1;i>=0;i--)
if(b[i]>lst)
lst++;
if(lst!=k)
cout<<-1<<'\n';
else{
for(int i=0;i<n;i++)
cout<<b[i]<<" ";
cout<<'\n';
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
504 KB |
Output is correct |
2 |
Correct |
2 ms |
504 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
376 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
376 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
376 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
376 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
376 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
22 ms |
2304 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
43 ms |
4056 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
43 ms |
4604 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |