# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
200187 | 2020-02-05T16:01:16 Z | Saboon | Karte (COCI18_karte) | C++14 | 141 ms | 10220 KB |
#include<bits/stdc++.h> using namespace std; typedef long long ll; const int maxn = 5e5 + 37; int a[maxn]; int main(){ ios_base::sync_with_stdio(false); int n, k; cin >> n >> k; for (int i = 1; i <= n; i++) cin >> a[i]; sort(a + 1, a + n + 1); vector<int> A, B; int now = 0; for (int i = 1; i <= n; i++){ if (a[i] > now){ now = min(k, now + 1); A.push_back(a[i]); continue; } B.push_back(a[i]); } if (A.size() < k) return cout << -1 << endl, 0; reverse(A.begin(), A.end()); while (A.size() > k){ B.push_back(A.back()); A.pop_back(); } for (auto it : B) cout << it << " "; for (auto it : A) cout << it << " "; cout << endl; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 376 KB | Output is correct |
2 | Incorrect | 5 ms | 376 KB | Output isn't correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 376 KB | Output is correct |
2 | Incorrect | 5 ms | 376 KB | Output isn't correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 376 KB | Output is correct |
2 | Correct | 5 ms | 376 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 6 ms | 376 KB | Output is correct |
2 | Correct | 5 ms | 376 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 376 KB | Output is correct |
2 | Incorrect | 5 ms | 376 KB | Output isn't correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 7 ms | 376 KB | Output is correct |
2 | Correct | 5 ms | 376 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 376 KB | Output is correct |
2 | Incorrect | 6 ms | 376 KB | Output isn't correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 33 ms | 2380 KB | Output is correct |
2 | Incorrect | 33 ms | 2544 KB | Output isn't correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 63 ms | 4452 KB | Output is correct |
2 | Incorrect | 57 ms | 4864 KB | Output isn't correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 141 ms | 10220 KB | Output is correct |
2 | Incorrect | 134 ms | 10220 KB | Output isn't correct |