# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
784873 |
2023-07-16T16:20:06 Z |
Nanu25 |
Karte (COCI18_karte) |
C++17 |
|
121 ms |
5396 KB |
#include <iostream>
#include <algorithm>
using namespace std;
const int DIM = 5 * 1e5;
int n, k;
int v[DIM + 5], a[DIM + 5];
int main() {
cin >> n >> k;
for(int i = 1; i <= n; i++)
cin >> v[i];
sort(v + 1, v + n + 1);
int t = 0;
for(int i = n; i > n - k; i--)
a[++t] = v[i]; //pun cele mai mari k numere pe primele pozitii
for(int i = 1; i <= k; i++)
a[++t] = v[i];
int fals = 0, adev = 0;
for(int i = 1; i <= n; i++)
if(a[i] > fals)
fals++;
adev = n - fals;
if(adev != k)
cout << -1;
else for(int i = 1; i <= n; i++)
cout << a[i] << " ";
return 0;
}
# |
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 |
212 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 |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
312 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
316 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 |
26 ms |
1396 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
49 ms |
2344 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
121 ms |
5396 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |