# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
270678 |
2020-08-17T22:48:01 Z |
wutwere |
Karte (COCI18_karte) |
C++17 |
|
123 ms |
10092 KB |
#include <bits/stdc++.h>
using namespace std;
using ll=int64_t;
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define _F(i,a,b,s) for(int i=(a);((s)>0?i<(b):i>(b));i+=(s))
#define _1(e) _F(i,0,e,1)
#define _2(i,e) _F(i,0,e,1)
#define _3(i,b,e) _F(i,b,e,(b)<(e)?1:-1)
#define _G(a,b,c,d,e,...) e
#define FOR(...) _G(__VA_ARGS__,_F,_3,_2,_1)(__VA_ARGS__)
int a[500000];
int main() {
ios::sync_with_stdio(0),cin.tie(0);
int n, k; cin >> n >> k;
FOR (i, n) cin >> a[i];
sort(a, a + n);
vector<int> ans;
FOR (i, k) {
int ni = n - k + i;
if (a[ni] >= i + 1) {
ans.pb(a[ni]);
} else {
cout << "-1\n";
return 0;
}
}
FOR (i, n - k) {
if (a[i] <= k) {
ans.pb(a[i]);
} else {
cout << "-1\n";
return 0;
}
}
FOR (i, n - 1, -1) cout << ans[i] << ' ';
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
384 KB |
Output is correct |
2 |
Correct |
0 ms |
384 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
384 KB |
Output is correct |
2 |
Correct |
1 ms |
512 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
384 KB |
Output is correct |
2 |
Correct |
0 ms |
384 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
384 KB |
Output is correct |
2 |
Correct |
1 ms |
384 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
384 KB |
Output is correct |
2 |
Correct |
1 ms |
384 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
384 KB |
Output is correct |
2 |
Correct |
1 ms |
384 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
384 KB |
Output is correct |
2 |
Correct |
1 ms |
384 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
27 ms |
2420 KB |
Output is correct |
2 |
Correct |
18 ms |
1792 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
49 ms |
4240 KB |
Output is correct |
2 |
Correct |
34 ms |
3572 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
123 ms |
10092 KB |
Output is correct |
2 |
Correct |
82 ms |
7508 KB |
Output is correct |