# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
900452 |
2024-01-08T10:21:15 Z |
n3rm1n |
Karte (COCI18_karte) |
C++17 |
|
82 ms |
7376 KB |
#include<bits/stdc++.h>
#define endl '\n'
using namespace std;
const int MAXN = 5e5 + 10;
void speed()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
}
int n, k, a[MAXN];
void read()
{
cin >> n >> k;
for (int i = 1; i <= n; ++ i)
cin >> a[i];
sort(a+1, a+n+1);
int cnt_false = 0;
vector < int > g;
for(int i = n - k + 1; i <= n; ++ i)
{
g.push_back(a[i]);
if(a[i] > cnt_false)cnt_false ++;
}
for (int i = 1; i <= n - k; ++ i)
{
g.push_back(a[i]);
if(a[i] > cnt_false)
{
cnt_false ++;
return;
}
}
//cout << cnt_false << endl;
if(cnt_false == k)
{
for (int i = g.size()-1; i >= 0; -- i)
cout << g[i] << " ";
cout << endl;
}
else cout << -1 << endl;
}
int main()
{
speed();
read();
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Failed |
0 ms |
348 KB |
Checker failed - contact admins or jury |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Failed |
0 ms |
348 KB |
Checker failed - contact admins or jury |
3 |
Halted |
0 ms |
0 KB |
- |
# |
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 |
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 |
348 KB |
Output is correct |
2 |
Failed |
0 ms |
348 KB |
Checker failed - contact admins or jury |
3 |
Halted |
0 ms |
0 KB |
- |
# |
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 |
1 ms |
348 KB |
Output is correct |
2 |
Failed |
1 ms |
344 KB |
Checker failed - contact admins or jury |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
19 ms |
1756 KB |
Output is correct |
2 |
Failed |
12 ms |
1756 KB |
Checker failed - contact admins or jury |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
34 ms |
3020 KB |
Output is correct |
2 |
Failed |
24 ms |
3488 KB |
Checker failed - contact admins or jury |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
82 ms |
6856 KB |
Output is correct |
2 |
Failed |
55 ms |
7376 KB |
Checker failed - contact admins or jury |
3 |
Halted |
0 ms |
0 KB |
- |