# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
40397 | 2018-01-31T13:16:27 Z | szawinis | Karte (COCI18_karte) | C++14 | 175 ms | 12304 KB |
#include <bits/stdc++.h> using namespace std; const int N = 5e5+1; int n, k, a[N]; int main() { scanf("%d %d", &n, &k); for(int i = 0; i < n; i++) scanf("%d", a+i); sort(a, a+n, greater<int>()); reverse(a, a+k); reverse(a+k, a+n); int cnt = 0; for(int i = 0; i < n; i++) cnt += cnt < a[i]; if(cnt != k) printf("-1"); else { reverse(a, a+n); for(int i = 0; i < n; i++) printf("%d ", a[i]); } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 248 KB | Output is correct |
2 | Correct | 2 ms | 352 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 408 KB | Output is correct |
2 | Correct | 1 ms | 624 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 624 KB | Output is correct |
2 | Correct | 1 ms | 624 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 624 KB | Output is correct |
2 | Correct | 2 ms | 804 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 804 KB | Output is correct |
2 | Correct | 1 ms | 804 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 816 KB | Output is correct |
2 | Correct | 2 ms | 828 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 840 KB | Output is correct |
2 | Correct | 3 ms | 852 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 37 ms | 2292 KB | Output is correct |
2 | Correct | 29 ms | 2372 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 63 ms | 5092 KB | Output is correct |
2 | Correct | 43 ms | 5312 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 175 ms | 12040 KB | Output is correct |
2 | Correct | 107 ms | 12304 KB | Output is correct |