# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1018617 |
2024-07-10T07:30:14 Z |
vjudge1 |
Karte (COCI18_karte) |
C++17 |
|
131 ms |
7764 KB |
#include<bits/stdc++.h>
using namespace std;
int main()
{
int n, k;
cin >> n >> k;
int a[n];
for(int i = 0; i < n; i ++)
cin >> a[i];
sort(a, a + n);
reverse(a + (n - k), a + n);
int cnt = 0;
for(int i = n - 1; i >= 0; i--)
if(cnt < a[i])
cnt++;
if(cnt != k)
cout << -1 << endl;
else
for(int i = 0; i < n; i ++)
cout << a[i] << " \n"[i == n-1];
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
436 KB |
Output is correct |
2 |
Correct |
0 ms |
344 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
440 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
1 ms |
444 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
38 ms |
1876 KB |
Output is correct |
2 |
Correct |
21 ms |
1368 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
53 ms |
3380 KB |
Output is correct |
2 |
Correct |
42 ms |
2140 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
131 ms |
7764 KB |
Output is correct |
2 |
Correct |
105 ms |
5308 KB |
Output is correct |