# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
730646 | 2023-04-26T08:32:16 Z | stefdasca | Karte (COCI18_karte) | C++14 | 114 ms | 13828 KB |
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(0); int n, m; cin >> n >> m; vector<int> nums(n); for (int i = 0; i < n; i++) cin >> nums[i]; sort(nums.begin(), nums.end()); int correct = n - m; vector<int> a; for (int i = correct - 1; i >= 0; i--) a.push_back(nums[i]); vector<int> b; for (int i = n - 1; i >= correct; i--) b.push_back(nums[i]); vector<int> vals; for (auto x: a) vals.push_back(x); for (auto x: b) vals.push_back(x); int bad = 0; for (int i = n - 1; i >= 0; i--) if (vals[i] > bad) bad++; if (bad == m) { for (int i = 0; i < n; i++) cout << vals[i] << " "; cout << '\n'; } else cout << -1 << '\n'; return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 340 KB | Output is correct |
2 | Correct | 1 ms | 340 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 340 KB | Output is correct |
2 | Correct | 1 ms | 328 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 340 KB | Output is correct |
2 | Correct | 1 ms | 340 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 340 KB | Output is correct |
2 | Correct | 1 ms | 340 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 23 ms | 3100 KB | Output is correct |
2 | Correct | 16 ms | 2472 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 45 ms | 5820 KB | Output is correct |
2 | Correct | 36 ms | 4608 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 114 ms | 13828 KB | Output is correct |
2 | Correct | 82 ms | 11144 KB | Output is correct |