# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
239566 |
2020-06-16T11:54:35 Z |
MrRobot_28 |
Karte (COCI18_karte) |
C++17 |
|
293 ms |
13920 KB |
#include <bits/stdc++.h>
using namespace std;
#define int long long
signed main()
{
// ios_base::sync_with_stdio(false);
// cin.tie(NULL);
// cout.tie(NULL);
int n, k;
cin >> n >> k;
vector <int> a(n);
for(int i = 0; i < n; i++)
{
cin >> a[i];
}
sort(a.begin(), a.end());
vector <int> res;
for(int i = n - k; i < n; i++)
{
res.push_back(a[i]);
}
for(int i = 0; i < n - k; i++)
{
res.push_back(a[i]);
}
int cnt = 0;
for(int i = 0; i < k; i++)
{
if(cnt >= res[i])
{
cout << -1;
return 0;
}
cnt++;
}
for(int i = k; i < n; i++)
{
if(cnt < res[i])
{
cout << -1;
return 0;
}
}
reverse(res.begin(), res.end());
for(int i = 0; i < n; i++)
{
cout << res[i] << " ";
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
256 KB |
Output is correct |
2 |
Correct |
5 ms |
384 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
384 KB |
Output is correct |
2 |
Correct |
5 ms |
384 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
384 KB |
Output is correct |
2 |
Correct |
4 ms |
256 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
384 KB |
Output is correct |
2 |
Correct |
5 ms |
384 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
384 KB |
Output is correct |
2 |
Correct |
5 ms |
384 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
384 KB |
Output is correct |
2 |
Correct |
5 ms |
384 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
384 KB |
Output is correct |
2 |
Correct |
6 ms |
384 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
63 ms |
3308 KB |
Output is correct |
2 |
Correct |
54 ms |
2924 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
120 ms |
6008 KB |
Output is correct |
2 |
Correct |
102 ms |
5228 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
293 ms |
13920 KB |
Output is correct |
2 |
Correct |
246 ms |
11552 KB |
Output is correct |